]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
2d21ac55 | 2 | * Copyright (c) 2000-2007 Apple Inc. All rights reserved. |
1c79356b | 3 | * |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
1c79356b | 5 | * |
2d21ac55 A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
8f6c56a5 | 14 | * |
2d21ac55 A |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
17 | * | |
18 | * The Original Code and all software distributed under the License are | |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
8f6c56a5 A |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
2d21ac55 A |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | * Please see the License for the specific language governing rights and | |
24 | * limitations under the License. | |
8f6c56a5 | 25 | * |
2d21ac55 | 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
1c79356b A |
27 | */ |
28 | /* | |
29 | * @OSF_COPYRIGHT@ | |
30 | */ | |
31 | /* | |
32 | * Mach Operating System | |
33 | * Copyright (c) 1991,1990 Carnegie Mellon University | |
34 | * All Rights Reserved. | |
35 | * | |
36 | * Permission to use, copy, modify and distribute this software and its | |
37 | * documentation is hereby granted, provided that both the copyright | |
38 | * notice and this permission notice appear in all copies of the | |
39 | * software, derivative works or modified versions, and any portions | |
40 | * thereof, and that both notices appear in supporting documentation. | |
41 | * | |
42 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | |
43 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR | |
44 | * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. | |
45 | * | |
46 | * Carnegie Mellon requests users of this software to return to | |
47 | * | |
48 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | |
49 | * School of Computer Science | |
50 | * Carnegie Mellon University | |
51 | * Pittsburgh PA 15213-3890 | |
52 | * | |
53 | * any improvements or extensions that they make and grant Carnegie Mellon | |
54 | * the rights to redistribute these changes. | |
55 | */ | |
56 | ||
57 | #include <platforms.h> | |
1c79356b A |
58 | #include <mach_kdb.h> |
59 | #include <mach_ldebug.h> | |
60 | #include <stat_time.h> | |
61 | ||
62 | /* | |
63 | * Pass field offsets to assembly code. | |
64 | */ | |
65 | #include <kern/ast.h> | |
66 | #include <kern/thread.h> | |
67 | #include <kern/task.h> | |
68 | #include <kern/lock.h> | |
91447636 | 69 | #include <kern/locks.h> |
0c530ab8 A |
70 | #include <kern/host.h> |
71 | #include <kern/misc_protos.h> | |
1c79356b A |
72 | #include <ipc/ipc_space.h> |
73 | #include <ipc/ipc_port.h> | |
74 | #include <ipc/ipc_pset.h> | |
0c530ab8 A |
75 | #include <vm/vm_map.h> |
76 | #include <i386/cpu_data.h> | |
1c79356b | 77 | #include <i386/thread.h> |
1c79356b A |
78 | #include <i386/seg.h> |
79 | #include <i386/pmap.h> | |
80 | #include <i386/tss.h> | |
91447636 | 81 | #include <i386/cpu_capabilities.h> |
0c530ab8 A |
82 | #include <i386/cpuid.h> |
83 | #include <i386/Diagnostics.h> | |
84 | #include <i386/pmCPU.h> | |
85 | #include <i386/hpet.h> | |
86 | #include <mach/i386/vm_param.h> | |
87 | #include <mach/i386/thread_status.h> | |
91447636 | 88 | #include <machine/commpage.h> |
1c79356b | 89 | #include <i386/mp_desc.h> |
91447636 | 90 | #include <pexpert/i386/boot.h> |
1c79356b | 91 | |
2d21ac55 A |
92 | #if CONFIG_DTRACE |
93 | #define NEED_DTRACE_DEFS | |
94 | #include <../bsd/sys/lockstat.h> | |
95 | #endif | |
96 | ||
1c79356b A |
97 | /* |
98 | * genassym.c is used to produce an | |
99 | * assembly file which, intermingled with unuseful assembly code, | |
100 | * has all the necessary definitions emitted. This assembly file is | |
101 | * then postprocessed with sed to extract only these definitions | |
102 | * and thus the final assyms.s is created. | |
103 | * | |
104 | * This convoluted means is necessary since the structure alignment | |
105 | * and packing may be different between the host machine and the | |
106 | * target so we are forced into using the cross compiler to generate | |
107 | * the values, but we cannot run anything on the target machine. | |
108 | */ | |
109 | ||
55e303ae | 110 | #undef offsetof |
1c79356b A |
111 | #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE)0)->MEMBER) |
112 | ||
113 | #if 0 | |
114 | #define DECLARE(SYM,VAL) \ | |
115 | __asm("#DEFINITION#\t.set\t" SYM ",\t%0" : : "n" ((u_int)(VAL))) | |
116 | #else | |
117 | #define DECLARE(SYM,VAL) \ | |
118 | __asm("#DEFINITION##define " SYM "\t%0" : : "n" ((u_int)(VAL))) | |
119 | #endif | |
120 | ||
121 | int main( | |
122 | int argc, | |
123 | char ** argv); | |
124 | ||
125 | int | |
126 | main( | |
127 | int argc, | |
128 | char **argv) | |
129 | { | |
130 | ||
131 | DECLARE("AST_URGENT", AST_URGENT); | |
2d21ac55 | 132 | DECLARE("AST_BSD", AST_BSD); |
1c79356b | 133 | |
55e303ae A |
134 | /* Simple Lock structure */ |
135 | DECLARE("SLOCK_ILK", offsetof(usimple_lock_t, interlock)); | |
136 | #if MACH_LDEBUG | |
137 | DECLARE("SLOCK_TYPE", offsetof(usimple_lock_t, lock_type)); | |
138 | DECLARE("SLOCK_PC", offsetof(usimple_lock_t, debug.lock_pc)); | |
139 | DECLARE("SLOCK_THREAD", offsetof(usimple_lock_t, debug.lock_thread)); | |
140 | DECLARE("SLOCK_DURATIONH",offsetof(usimple_lock_t, debug.duration[0])); | |
141 | DECLARE("SLOCK_DURATIONL",offsetof(usimple_lock_t, debug.duration[1])); | |
142 | DECLARE("USLOCK_TAG", USLOCK_TAG); | |
143 | #endif /* MACH_LDEBUG */ | |
144 | ||
145 | /* Mutex structure */ | |
91447636 A |
146 | DECLARE("MUTEX_LOCKED", offsetof(mutex_t *, lck_mtx.lck_mtx_locked)); |
147 | DECLARE("MUTEX_WAITERS",offsetof(mutex_t *, lck_mtx.lck_mtx_waiters)); | |
148 | DECLARE("MUTEX_PROMOTED_PRI",offsetof(mutex_t *, lck_mtx.lck_mtx_pri)); | |
55e303ae A |
149 | #if MACH_LDEBUG |
150 | DECLARE("MUTEX_TYPE", offsetof(mutex_t *, type)); | |
151 | DECLARE("MUTEX_PC", offsetof(mutex_t *, pc)); | |
152 | DECLARE("MUTEX_THREAD", offsetof(mutex_t *, thread)); | |
153 | DECLARE("MUTEX_TAG", MUTEX_TAG); | |
154 | #endif /* MACH_LDEBUG */ | |
91447636 | 155 | DECLARE("MUTEX_IND", LCK_MTX_TAG_INDIRECT); |
2d21ac55 A |
156 | DECLARE("MUTEX_DESTROYED", LCK_MTX_TAG_DESTROYED); |
157 | DECLARE("MUTEX_LOCKED_AS_SPIN", MUTEX_LOCKED_AS_SPIN); | |
91447636 A |
158 | DECLARE("MUTEX_ITAG", offsetof(lck_mtx_t *, lck_mtx_tag)); |
159 | DECLARE("MUTEX_PTR", offsetof(lck_mtx_t *, lck_mtx_ptr)); | |
2d21ac55 A |
160 | DECLARE("MUTEX_ASSERT_OWNED", LCK_MTX_ASSERT_OWNED); |
161 | DECLARE("MUTEX_ASSERT_NOTOWNED",LCK_MTX_ASSERT_NOTOWNED); | |
162 | /* Per-mutex statistic element */ | |
163 | DECLARE("MTX_ACQ_TSC", offsetof(lck_mtx_ext_t *, lck_mtx_stat)); | |
164 | ||
165 | /* Mutex group statistics elements */ | |
166 | DECLARE("MUTEX_GRP", offsetof(lck_mtx_ext_t *, lck_mtx_grp)); | |
167 | ||
168 | DECLARE("GRP_MTX_STAT_UTIL", offsetof(lck_grp_t *, lck_grp_stat.lck_grp_mtx_stat.lck_grp_mtx_util_cnt)); | |
169 | DECLARE("GRP_MTX_STAT_MISS", offsetof(lck_grp_t *, lck_grp_stat.lck_grp_mtx_stat.lck_grp_mtx_miss_cnt)); | |
170 | DECLARE("GRP_MTX_STAT_WAIT", offsetof(lck_grp_t *, lck_grp_stat.lck_grp_mtx_stat.lck_grp_mtx_wait_cnt)); | |
171 | /* | |
172 | * The use of this field is somewhat at variance with the alias. | |
173 | */ | |
174 | DECLARE("GRP_MTX_STAT_DIRECT_WAIT", offsetof(lck_grp_t *, lck_grp_stat.lck_grp_mtx_stat.lck_grp_mtx_held_cnt)); | |
175 | ||
176 | DECLARE("GRP_MTX_STAT_HELD_MAX", offsetof(lck_grp_t *, lck_grp_stat.lck_grp_mtx_stat.lck_grp_mtx_held_max)); | |
177 | /* Reader writer lock types */ | |
178 | DECLARE("RW_SHARED", LCK_RW_TYPE_SHARED); | |
179 | DECLARE("RW_EXCL", LCK_RW_TYPE_EXCLUSIVE); | |
91447636 | 180 | |
1c79356b A |
181 | DECLARE("TH_RECOVER", offsetof(thread_t, recover)); |
182 | DECLARE("TH_CONTINUATION", offsetof(thread_t, continuation)); | |
1c79356b A |
183 | DECLARE("TH_KERNEL_STACK", offsetof(thread_t, kernel_stack)); |
184 | ||
1c79356b A |
185 | DECLARE("TASK_MACH_EXC_PORT", |
186 | offsetof(task_t, exc_actions[EXC_MACH_SYSCALL].port)); | |
0c530ab8 A |
187 | DECLARE("TASK_SYSCALLS_MACH", offsetof(struct task *, syscalls_mach)); |
188 | DECLARE("TASK_SYSCALLS_UNIX", offsetof(struct task *, syscalls_unix)); | |
1c79356b | 189 | |
2d21ac55 A |
190 | DECLARE("TASK_VTIMERS", offsetof(struct task *, vtimers)); |
191 | ||
1c79356b A |
192 | /* These fields are being added on demand */ |
193 | DECLARE("ACT_MACH_EXC_PORT", | |
91447636 | 194 | offsetof(thread_t, exc_actions[EXC_MACH_SYSCALL].port)); |
1c79356b | 195 | |
91447636 | 196 | DECLARE("ACT_TASK", offsetof(thread_t, task)); |
2d21ac55 | 197 | DECLARE("ACT_AST", offsetof(thread_t, ast)); |
91447636 | 198 | DECLARE("ACT_PCB", offsetof(thread_t, machine.pcb)); |
0c530ab8 | 199 | DECLARE("ACT_SPF", offsetof(thread_t, machine.specFlags)); |
91447636 | 200 | DECLARE("ACT_MAP", offsetof(thread_t, map)); |
0c530ab8 A |
201 | DECLARE("ACT_COPYIO_STATE", offsetof(thread_t, machine.copyio_state)); |
202 | DECLARE("ACT_PCB_ISS", offsetof(thread_t, machine.xxx_pcb.iss)); | |
203 | DECLARE("ACT_PCB_IDS", offsetof(thread_t, machine.xxx_pcb.ids)); | |
204 | ||
205 | DECLARE("WINDOWS_CLEAN", WINDOWS_CLEAN); | |
1c79356b A |
206 | |
207 | DECLARE("MAP_PMAP", offsetof(vm_map_t, pmap)); | |
208 | ||
1c79356b A |
209 | #define IKS ((size_t) (STACK_IKS(0))) |
210 | ||
0c530ab8 A |
211 | DECLARE("KSS_EBX", IKS + offsetof(struct x86_kernel_state32 *, k_ebx)); |
212 | DECLARE("KSS_ESP", IKS + offsetof(struct x86_kernel_state32 *, k_esp)); | |
213 | DECLARE("KSS_EBP", IKS + offsetof(struct x86_kernel_state32 *, k_ebp)); | |
214 | DECLARE("KSS_EDI", IKS + offsetof(struct x86_kernel_state32 *, k_edi)); | |
215 | DECLARE("KSS_ESI", IKS + offsetof(struct x86_kernel_state32 *, k_esi)); | |
216 | DECLARE("KSS_EIP", IKS + offsetof(struct x86_kernel_state32 *, k_eip)); | |
1c79356b | 217 | |
0c530ab8 | 218 | DECLARE("IKS_SIZE", sizeof(struct x86_kernel_state32)); |
1c79356b A |
219 | DECLARE("IEL_SIZE", sizeof(struct i386_exception_link)); |
220 | ||
0c530ab8 | 221 | DECLARE("PCB_FPS", offsetof(pcb_t, ifps)); |
1c79356b A |
222 | DECLARE("PCB_ISS", offsetof(pcb_t, iss)); |
223 | ||
0c530ab8 A |
224 | DECLARE("DS_DR0", offsetof(struct x86_debug_state32 *, dr0)); |
225 | DECLARE("DS_DR1", offsetof(struct x86_debug_state32 *, dr1)); | |
226 | DECLARE("DS_DR2", offsetof(struct x86_debug_state32 *, dr2)); | |
227 | DECLARE("DS_DR3", offsetof(struct x86_debug_state32 *, dr3)); | |
228 | DECLARE("DS_DR4", offsetof(struct x86_debug_state32 *, dr4)); | |
229 | DECLARE("DS_DR5", offsetof(struct x86_debug_state32 *, dr5)); | |
230 | DECLARE("DS_DR6", offsetof(struct x86_debug_state32 *, dr6)); | |
231 | DECLARE("DS_DR7", offsetof(struct x86_debug_state32 *, dr7)); | |
232 | ||
233 | DECLARE("DS64_DR0", offsetof(struct x86_debug_state64 *, dr0)); | |
234 | DECLARE("DS64_DR1", offsetof(struct x86_debug_state64 *, dr1)); | |
235 | DECLARE("DS64_DR2", offsetof(struct x86_debug_state64 *, dr2)); | |
236 | DECLARE("DS64_DR3", offsetof(struct x86_debug_state64 *, dr3)); | |
237 | DECLARE("DS64_DR4", offsetof(struct x86_debug_state64 *, dr4)); | |
238 | DECLARE("DS64_DR5", offsetof(struct x86_debug_state64 *, dr5)); | |
239 | DECLARE("DS64_DR6", offsetof(struct x86_debug_state64 *, dr6)); | |
240 | DECLARE("DS64_DR7", offsetof(struct x86_debug_state64 *, dr7)); | |
241 | ||
242 | DECLARE("FP_VALID", offsetof(struct x86_fpsave_state *,fp_valid)); | |
243 | ||
244 | DECLARE("SS_FLAVOR", offsetof(x86_saved_state_t *, flavor)); | |
245 | DECLARE("SS_32", x86_SAVED_STATE32); | |
246 | DECLARE("SS_64", x86_SAVED_STATE64); | |
247 | ||
248 | #define R_(x) offsetof(x86_saved_state_t *, ss_32.x) | |
249 | DECLARE("R_CS", R_(cs)); | |
250 | DECLARE("R_SS", R_(ss)); | |
251 | DECLARE("R_DS", R_(ds)); | |
252 | DECLARE("R_ES", R_(es)); | |
253 | DECLARE("R_FS", R_(fs)); | |
254 | DECLARE("R_GS", R_(gs)); | |
255 | DECLARE("R_UESP", R_(uesp)); | |
256 | DECLARE("R_EBP", R_(ebp)); | |
257 | DECLARE("R_EAX", R_(eax)); | |
258 | DECLARE("R_EBX", R_(ebx)); | |
259 | DECLARE("R_ECX", R_(ecx)); | |
260 | DECLARE("R_EDX", R_(edx)); | |
261 | DECLARE("R_ESI", R_(esi)); | |
262 | DECLARE("R_EDI", R_(edi)); | |
263 | DECLARE("R_TRAPNO", R_(trapno)); | |
264 | DECLARE("R_ERR", R_(err)); | |
265 | DECLARE("R_EFLAGS", R_(efl)); | |
266 | DECLARE("R_EIP", R_(eip)); | |
267 | DECLARE("R_CR2", R_(cr2)); | |
268 | DECLARE("ISS32_SIZE", sizeof (x86_saved_state32_t)); | |
269 | ||
270 | #define R64_(x) offsetof(x86_saved_state_t *, ss_64.x) | |
271 | DECLARE("R64_FS", R64_(fs)); | |
272 | DECLARE("R64_GS", R64_(gs)); | |
273 | DECLARE("R64_R8", R64_(r8)); | |
274 | DECLARE("R64_R9", R64_(r9)); | |
275 | DECLARE("R64_R10", R64_(r10)); | |
276 | DECLARE("R64_R11", R64_(r11)); | |
277 | DECLARE("R64_R12", R64_(r12)); | |
278 | DECLARE("R64_R13", R64_(r13)); | |
279 | DECLARE("R64_R14", R64_(r14)); | |
280 | DECLARE("R64_R15", R64_(r15)); | |
281 | DECLARE("R64_RBP", R64_(rbp)); | |
282 | DECLARE("R64_RAX", R64_(rax)); | |
283 | DECLARE("R64_RBX", R64_(rbx)); | |
284 | DECLARE("R64_RCX", R64_(rcx)); | |
285 | DECLARE("R64_RDX", R64_(rdx)); | |
286 | DECLARE("R64_RSI", R64_(rsi)); | |
287 | DECLARE("R64_RDI", R64_(rdi)); | |
288 | DECLARE("R64_V_ARG6", R64_(v_arg6)); | |
289 | DECLARE("R64_V_ARG7", R64_(v_arg7)); | |
290 | DECLARE("R64_V_ARG8", R64_(v_arg8)); | |
291 | DECLARE("R64_CS", R64_(isf.cs)); | |
292 | DECLARE("R64_SS", R64_(isf.ss)); | |
293 | DECLARE("R64_RSP", R64_(isf.rsp)); | |
294 | DECLARE("R64_TRAPNO", R64_(isf.trapno)); | |
295 | DECLARE("R64_TRAPFN", R64_(isf.trapfn)); | |
296 | DECLARE("R64_ERR", R64_(isf.err)); | |
297 | DECLARE("R64_RFLAGS", R64_(isf.rflags)); | |
298 | DECLARE("R64_RIP", R64_(isf.rip)); | |
299 | DECLARE("R64_CR2", R64_(cr2)); | |
300 | DECLARE("ISS64_OFFSET", R64_(isf)); | |
301 | DECLARE("ISS64_SIZE", sizeof (x86_saved_state64_t)); | |
302 | ||
303 | #define ISF64_(x) offsetof(x86_64_intr_stack_frame_t *, x) | |
304 | DECLARE("ISF64_TRAPNO", ISF64_(trapno)); | |
305 | DECLARE("ISF64_TRAPFN", ISF64_(trapfn)); | |
306 | DECLARE("ISF64_ERR", ISF64_(err)); | |
307 | DECLARE("ISF64_RIP", ISF64_(rip)); | |
308 | DECLARE("ISF64_CS", ISF64_(cs)); | |
309 | DECLARE("ISF64_RFLAGS", ISF64_(rflags)); | |
310 | DECLARE("ISF64_RSP", ISF64_(rsp)); | |
311 | DECLARE("ISF64_SS", ISF64_(ss)); | |
312 | DECLARE("ISF64_SIZE", sizeof(x86_64_intr_stack_frame_t)); | |
313 | ||
314 | DECLARE("ISC32_OFFSET", offsetof(x86_saved_state_compat32_t *, isf64)); | |
315 | #define ISC32_(x) offsetof(x86_saved_state_compat32_t *, isf64.x) | |
316 | DECLARE("ISC32_TRAPNO", ISC32_(trapno)); | |
317 | DECLARE("ISC32_TRAPFN", ISC32_(trapfn)); | |
318 | DECLARE("ISC32_ERR", ISC32_(err)); | |
319 | DECLARE("ISC32_RIP", ISC32_(rip)); | |
320 | DECLARE("ISC32_CS", ISC32_(cs)); | |
321 | DECLARE("ISC32_RFLAGS", ISC32_(rflags)); | |
322 | DECLARE("ISC32_RSP", ISC32_(rsp)); | |
323 | DECLARE("ISC32_SS", ISC32_(ss)); | |
1c79356b A |
324 | |
325 | DECLARE("NBPG", I386_PGBYTES); | |
91447636 A |
326 | DECLARE("PAGE_SIZE", I386_PGBYTES); |
327 | DECLARE("PAGE_MASK", I386_PGBYTES-1); | |
328 | DECLARE("PAGE_SHIFT", 12); | |
329 | DECLARE("NKPT", NKPT); | |
330 | DECLARE("KPTDI", KPTDI); | |
1c79356b A |
331 | DECLARE("VM_MIN_ADDRESS", VM_MIN_ADDRESS); |
332 | DECLARE("VM_MAX_ADDRESS", VM_MAX_ADDRESS); | |
333 | DECLARE("KERNELBASE", VM_MIN_KERNEL_ADDRESS); | |
334 | DECLARE("LINEAR_KERNELBASE", LINEAR_KERNEL_ADDRESS); | |
335 | DECLARE("KERNEL_STACK_SIZE", KERNEL_STACK_SIZE); | |
0c530ab8 | 336 | DECLARE("KERNEL_UBER_BASE_HI32", KERNEL_UBER_BASE_HI32); |
1c79356b | 337 | |
91447636 A |
338 | DECLARE("COMM_PAGE_BASE_ADDR", _COMM_PAGE_BASE_ADDRESS); |
339 | ||
1c79356b | 340 | DECLARE("PDESHIFT", PDESHIFT); |
1c79356b | 341 | DECLARE("PTEMASK", PTEMASK); |
91447636 | 342 | DECLARE("PTEINDX", PTEINDX); |
1c79356b A |
343 | DECLARE("PTE_PFN", INTEL_PTE_PFN); |
344 | DECLARE("PTE_V", INTEL_PTE_VALID); | |
345 | DECLARE("PTE_W", INTEL_PTE_WRITE); | |
91447636 A |
346 | DECLARE("PTE_PS", INTEL_PTE_PS); |
347 | DECLARE("PTE_U", INTEL_PTE_USER); | |
1c79356b | 348 | DECLARE("PTE_INVALID", ~INTEL_PTE_VALID); |
91447636 | 349 | DECLARE("NPGPTD", NPGPTD); |
1c79356b A |
350 | |
351 | DECLARE("IDTSZ", IDTSZ); | |
352 | DECLARE("GDTSZ", GDTSZ); | |
353 | DECLARE("LDTSZ", LDTSZ); | |
354 | ||
355 | DECLARE("KERNEL_CS", KERNEL_CS); | |
356 | DECLARE("KERNEL_DS", KERNEL_DS); | |
357 | DECLARE("USER_CS", USER_CS); | |
358 | DECLARE("USER_DS", USER_DS); | |
0c530ab8 A |
359 | DECLARE("KERNEL64_CS", KERNEL64_CS); |
360 | DECLARE("USER64_CS", USER64_CS); | |
1c79356b A |
361 | DECLARE("KERNEL_TSS", KERNEL_TSS); |
362 | DECLARE("KERNEL_LDT", KERNEL_LDT); | |
0c530ab8 A |
363 | DECLARE("DF_TSS", DF_TSS); |
364 | DECLARE("MC_TSS", MC_TSS); | |
1c79356b A |
365 | #if MACH_KDB |
366 | DECLARE("DEBUG_TSS", DEBUG_TSS); | |
367 | #endif /* MACH_KDB */ | |
91447636 | 368 | DECLARE("CPU_DATA_GS", CPU_DATA_GS); |
0c530ab8 A |
369 | DECLARE("SYSENTER_CS", SYSENTER_CS); |
370 | DECLARE("SYSENTER_TF_CS",SYSENTER_TF_CS); | |
371 | DECLARE("SYSENTER_DS", SYSENTER_DS); | |
372 | DECLARE("SYSCALL_CS", SYSCALL_CS); | |
373 | DECLARE("USER_WINDOW_SEL", USER_WINDOW_SEL); | |
374 | DECLARE("PHYS_WINDOW_SEL", PHYS_WINDOW_SEL); | |
91447636 A |
375 | |
376 | DECLARE("CPU_THIS", | |
377 | offsetof(cpu_data_t *, cpu_this)); | |
378 | DECLARE("CPU_ACTIVE_THREAD", | |
379 | offsetof(cpu_data_t *, cpu_active_thread)); | |
91447636 A |
380 | DECLARE("CPU_ACTIVE_STACK", |
381 | offsetof(cpu_data_t *, cpu_active_stack)); | |
382 | DECLARE("CPU_KERNEL_STACK", | |
383 | offsetof(cpu_data_t *, cpu_kernel_stack)); | |
384 | DECLARE("CPU_INT_STACK_TOP", | |
385 | offsetof(cpu_data_t *, cpu_int_stack_top)); | |
1c79356b | 386 | #if MACH_RT |
91447636 A |
387 | DECLARE("CPU_PREEMPTION_LEVEL", |
388 | offsetof(cpu_data_t *, cpu_preemption_level)); | |
1c79356b | 389 | #endif /* MACH_RT */ |
91447636 A |
390 | DECLARE("CPU_INTERRUPT_LEVEL", |
391 | offsetof(cpu_data_t *, cpu_interrupt_level)); | |
392 | DECLARE("CPU_SIMPLE_LOCK_COUNT", | |
393 | offsetof(cpu_data_t *,cpu_simple_lock_count)); | |
394 | DECLARE("CPU_NUMBER_GS", | |
55e303ae | 395 | offsetof(cpu_data_t *,cpu_number)); |
91447636 A |
396 | DECLARE("CPU_RUNNING", |
397 | offsetof(cpu_data_t *,cpu_running)); | |
398 | DECLARE("CPU_MCOUNT_OFF", | |
399 | offsetof(cpu_data_t *,cpu_mcount_off)); | |
400 | DECLARE("CPU_PENDING_AST", | |
401 | offsetof(cpu_data_t *,cpu_pending_ast)); | |
402 | DECLARE("CPU_DESC_TABLEP", | |
403 | offsetof(cpu_data_t *,cpu_desc_tablep)); | |
0c530ab8 A |
404 | DECLARE("CPU_DESC_INDEX", |
405 | offsetof(cpu_data_t *,cpu_desc_index)); | |
406 | DECLARE("CDI_GDT", | |
407 | offsetof(cpu_desc_index_t *,cdi_gdt)); | |
408 | DECLARE("CDI_IDT", | |
409 | offsetof(cpu_desc_index_t *,cdi_idt)); | |
91447636 A |
410 | DECLARE("CPU_PROCESSOR", |
411 | offsetof(cpu_data_t *,cpu_processor)); | |
0c530ab8 A |
412 | DECLARE("CPU_INT_STATE", |
413 | offsetof(cpu_data_t *, cpu_int_state)); | |
2d21ac55 A |
414 | DECLARE("CPU_INT_EVENT_TIME", |
415 | offsetof(cpu_data_t *, cpu_int_event_time)); | |
0c530ab8 A |
416 | |
417 | DECLARE("CPU_HI_ISS", | |
418 | offsetof(cpu_data_t *, cpu_hi_iss)); | |
419 | DECLARE("CPU_TASK_CR3", | |
420 | offsetof(cpu_data_t *, cpu_task_cr3)); | |
421 | DECLARE("CPU_ACTIVE_CR3", | |
422 | offsetof(cpu_data_t *, cpu_active_cr3)); | |
423 | DECLARE("CPU_KERNEL_CR3", | |
424 | offsetof(cpu_data_t *, cpu_kernel_cr3)); | |
425 | ||
426 | DECLARE("CPU_IS64BIT", | |
427 | offsetof(cpu_data_t *, cpu_is64bit)); | |
428 | DECLARE("CPU_TASK_MAP", | |
429 | offsetof(cpu_data_t *, cpu_task_map)); | |
430 | DECLARE("TASK_MAP_32BIT", TASK_MAP_32BIT); | |
431 | DECLARE("TASK_MAP_64BIT", TASK_MAP_64BIT); | |
432 | DECLARE("TASK_MAP_64BIT_SHARED", TASK_MAP_64BIT_SHARED); | |
433 | DECLARE("CPU_UBER_USER_GS_BASE", | |
434 | offsetof(cpu_data_t *, cpu_uber.cu_user_gs_base)); | |
435 | DECLARE("CPU_UBER_ISF", | |
436 | offsetof(cpu_data_t *, cpu_uber.cu_isf)); | |
437 | DECLARE("CPU_UBER_TMP", | |
438 | offsetof(cpu_data_t *, cpu_uber.cu_tmp)); | |
2d21ac55 A |
439 | DECLARE("CPU_UBER_ARG_STORE", |
440 | offsetof(cpu_data_t *, cpu_uber_arg_store)); | |
441 | DECLARE("CPU_UBER_ARG_STORE_VALID", | |
442 | offsetof(cpu_data_t *, cpu_uber_arg_store_valid)); | |
443 | ||
0c530ab8 A |
444 | DECLARE("CPU_DR7", |
445 | offsetof(cpu_data_t *, cpu_dr7)); | |
446 | ||
447 | DECLARE("hwIntCnt", offsetof(cpu_data_t *,cpu_hwIntCnt)); | |
448 | ||
449 | DECLARE("enaExpTrace", enaExpTrace); | |
450 | DECLARE("enaExpTraceb", enaExpTraceb); | |
451 | DECLARE("enaUsrFCall", enaUsrFCall); | |
452 | DECLARE("enaUsrFCallb", enaUsrFCallb); | |
453 | DECLARE("enaUsrPhyMp", enaUsrPhyMp); | |
454 | DECLARE("enaUsrPhyMpb", enaUsrPhyMpb); | |
455 | DECLARE("enaDiagSCs", enaDiagSCs); | |
456 | DECLARE("enaDiagSCsb", enaDiagSCsb); | |
457 | DECLARE("enaDiagEM", enaDiagEM); | |
458 | DECLARE("enaDiagEMb", enaDiagEMb); | |
459 | DECLARE("enaNotifyEM", enaNotifyEM); | |
460 | DECLARE("enaNotifyEMb", enaNotifyEMb); | |
461 | DECLARE("dgLock", offsetof(struct diagWork *, dgLock)); | |
462 | DECLARE("dgFlags", offsetof(struct diagWork *, dgFlags)); | |
463 | DECLARE("dgMisc1", offsetof(struct diagWork *, dgMisc1)); | |
464 | DECLARE("dgMisc2", offsetof(struct diagWork *, dgMisc2)); | |
465 | DECLARE("dgMisc3", offsetof(struct diagWork *, dgMisc3)); | |
466 | DECLARE("dgMisc4", offsetof(struct diagWork *, dgMisc4)); | |
467 | DECLARE("dgMisc5", offsetof(struct diagWork *, dgMisc5)); | |
91447636 | 468 | |
1c79356b | 469 | DECLARE("INTEL_PTE_KERNEL", INTEL_PTE_VALID|INTEL_PTE_WRITE); |
91447636 A |
470 | DECLARE("PTDPTDI", PTDPTDI); |
471 | DECLARE("PDESHIFT", PDESHIFT); | |
472 | DECLARE("PDESIZE", PDESIZE); | |
473 | DECLARE("PTESIZE", PTESIZE); | |
474 | DECLARE("APTDPTDI", APTDPTDI); | |
0c530ab8 A |
475 | DECLARE("HIGH_MEM_BASE", HIGH_MEM_BASE); |
476 | DECLARE("HIGH_IDT_BASE", pmap_index_to_virt(HIGH_FIXED_IDT)); | |
1c79356b A |
477 | |
478 | DECLARE("KERNELBASEPDE", | |
479 | (LINEAR_KERNEL_ADDRESS >> PDESHIFT) * | |
480 | sizeof(pt_entry_t)); | |
481 | ||
482 | DECLARE("TSS_ESP0", offsetof(struct i386_tss *, esp0)); | |
483 | DECLARE("TSS_SS0", offsetof(struct i386_tss *, ss0)); | |
484 | DECLARE("TSS_LDT", offsetof(struct i386_tss *, ldt)); | |
485 | DECLARE("TSS_PDBR", offsetof(struct i386_tss *, cr3)); | |
486 | DECLARE("TSS_LINK", offsetof(struct i386_tss *, back_link)); | |
487 | ||
488 | DECLARE("K_TASK_GATE", ACC_P|ACC_PL_K|ACC_TASK_GATE); | |
489 | DECLARE("K_TRAP_GATE", ACC_P|ACC_PL_K|ACC_TRAP_GATE); | |
490 | DECLARE("U_TRAP_GATE", ACC_P|ACC_PL_U|ACC_TRAP_GATE); | |
491 | DECLARE("K_INTR_GATE", ACC_P|ACC_PL_K|ACC_INTR_GATE); | |
0c530ab8 | 492 | DECLARE("U_INTR_GATE", ACC_P|ACC_PL_U|ACC_INTR_GATE); |
1c79356b A |
493 | DECLARE("K_TSS", ACC_P|ACC_PL_K|ACC_TSS); |
494 | ||
495 | /* | |
496 | * usimple_lock fields | |
497 | */ | |
498 | DECLARE("USL_INTERLOCK", offsetof(usimple_lock_t, interlock)); | |
499 | ||
500 | DECLARE("INTSTACK_SIZE", INTSTACK_SIZE); | |
91447636 A |
501 | DECLARE("TIMER_LOW", offsetof(struct timer *, low_bits)); |
502 | DECLARE("TIMER_HIGH", offsetof(struct timer *, high_bits)); | |
503 | DECLARE("TIMER_HIGHCHK", offsetof(struct timer *, high_bits_check)); | |
0c530ab8 A |
504 | DECLARE("KADDR", offsetof(struct boot_args *, kaddr)); |
505 | DECLARE("KSIZE", offsetof(struct boot_args *, ksize)); | |
506 | DECLARE("MEMORYMAP", offsetof(struct boot_args *, MemoryMap)); | |
507 | DECLARE("DEVICETREEP", offsetof(struct boot_args *, deviceTreeP)); | |
508 | ||
509 | DECLARE("RNT_TSC_BASE", | |
510 | offsetof(rtc_nanotime_t *, tsc_base)); | |
511 | DECLARE("RNT_NS_BASE", | |
512 | offsetof(rtc_nanotime_t *, ns_base)); | |
513 | DECLARE("RNT_SCALE", | |
514 | offsetof(rtc_nanotime_t *, scale)); | |
515 | DECLARE("RNT_SHIFT", | |
516 | offsetof(rtc_nanotime_t *, shift)); | |
2d21ac55 A |
517 | DECLARE("RNT_GENERATION", |
518 | offsetof(rtc_nanotime_t *, generation)); | |
91447636 A |
519 | |
520 | /* values from kern/timer.h */ | |
521 | DECLARE("TIMER_LOW", | |
522 | offsetof(struct timer *, low_bits)); | |
523 | DECLARE("TIMER_HIGH", | |
524 | offsetof(struct timer *, high_bits)); | |
525 | DECLARE("TIMER_HIGHCHK", | |
526 | offsetof(struct timer *, high_bits_check)); | |
527 | #if !STAT_TIME | |
528 | DECLARE("TIMER_TSTAMP", | |
529 | offsetof(struct timer *, tstamp)); | |
530 | ||
2d21ac55 A |
531 | DECLARE("THREAD_TIMER", |
532 | offsetof(struct processor *, processor_data.thread_timer)); | |
1c79356b | 533 | #endif |
2d21ac55 A |
534 | DECLARE("KERNEL_TIMER", |
535 | offsetof(struct processor *, processor_data.kernel_timer)); | |
91447636 A |
536 | DECLARE("SYSTEM_TIMER", |
537 | offsetof(struct thread *, system_timer)); | |
538 | DECLARE("USER_TIMER", | |
539 | offsetof(struct thread *, user_timer)); | |
2d21ac55 A |
540 | DECLARE("SYSTEM_STATE", |
541 | offsetof(struct processor *, processor_data.system_state)); | |
542 | DECLARE("USER_STATE", | |
543 | offsetof(struct processor *, processor_data.user_state)); | |
544 | DECLARE("IDLE_STATE", | |
545 | offsetof(struct processor *, processor_data.idle_state)); | |
546 | DECLARE("CURRENT_STATE", | |
547 | offsetof(struct processor *, processor_data.current_state)); | |
1c79356b | 548 | |
0c530ab8 A |
549 | DECLARE("OnProc", OnProc); |
550 | ||
551 | ||
552 | DECLARE("GCAP_ID", offsetof(hpetReg_t *, GCAP_ID)); | |
553 | DECLARE("GEN_CONF", offsetof(hpetReg_t *, GEN_CONF)); | |
554 | DECLARE("GINTR_STA", offsetof(hpetReg_t *, GINTR_STA)); | |
555 | DECLARE("MAIN_CNT", offsetof(hpetReg_t *, MAIN_CNT)); | |
556 | DECLARE("TIM0_CONF", offsetof(hpetReg_t *, TIM0_CONF)); | |
557 | DECLARE("TIM_CONF", TIM_CONF); | |
558 | DECLARE("Tn_INT_ENB_CNF", Tn_INT_ENB_CNF); | |
559 | DECLARE("TIM0_COMP", offsetof(hpetReg_t *, TIM0_COMP)); | |
560 | DECLARE("TIM_COMP", TIM_COMP); | |
561 | DECLARE("TIM1_CONF", offsetof(hpetReg_t *, TIM1_CONF)); | |
562 | DECLARE("TIM1_COMP", offsetof(hpetReg_t *, TIM1_COMP)); | |
563 | DECLARE("TIM2_CONF", offsetof(hpetReg_t *, TIM2_CONF)); | |
564 | DECLARE("TIM2_COMP", offsetof(hpetReg_t *, TIM2_COMP)); | |
565 | ||
2d21ac55 A |
566 | #if CONFIG_DTRACE |
567 | DECLARE("LS_LCK_MTX_LOCK_ACQUIRE", LS_LCK_MTX_LOCK_ACQUIRE); | |
568 | DECLARE("LS_LCK_MTX_TRY_SPIN_LOCK_ACQUIRE", LS_LCK_MTX_TRY_SPIN_LOCK_ACQUIRE); | |
569 | DECLARE("LS_LCK_MTX_UNLOCK_RELEASE", LS_LCK_MTX_UNLOCK_RELEASE); | |
570 | DECLARE("LS_LCK_MTX_TRY_LOCK_ACQUIRE", LS_LCK_MTX_TRY_LOCK_ACQUIRE); | |
571 | DECLARE("LS_LCK_RW_LOCK_SHARED_ACQUIRE", LS_LCK_RW_LOCK_SHARED_ACQUIRE); | |
572 | DECLARE("LS_LCK_RW_DONE_RELEASE", LS_LCK_RW_DONE_RELEASE); | |
573 | DECLARE("LS_LCK_MTX_EXT_LOCK_ACQUIRE", LS_LCK_MTX_EXT_LOCK_ACQUIRE); | |
574 | DECLARE("LS_LCK_MTX_TRY_EXT_LOCK_ACQUIRE", LS_LCK_MTX_TRY_EXT_LOCK_ACQUIRE); | |
575 | DECLARE("LS_LCK_MTX_EXT_UNLOCK_RELEASE", LS_LCK_MTX_EXT_UNLOCK_RELEASE); | |
576 | ||
577 | DECLARE("LS_MUTEX_LOCK_ACQUIRE", LS_MUTEX_LOCK_ACQUIRE); | |
578 | DECLARE("LS_MUTEX_TRY_SPIN_ACQUIRE", LS_MUTEX_TRY_SPIN_ACQUIRE); | |
579 | DECLARE("LS_MUTEX_TRY_LOCK_ACQUIRE", LS_MUTEX_TRY_LOCK_ACQUIRE); | |
580 | DECLARE("LS_MUTEX_UNLOCK_RELEASE", LS_MUTEX_UNLOCK_RELEASE); | |
581 | DECLARE("LS_MUTEX_LOCK_SPIN_ACQUIRE", LS_MUTEX_LOCK_SPIN_ACQUIRE); | |
582 | DECLARE("LS_MUTEX_CONVERT_SPIN_ACQUIRE", LS_MUTEX_CONVERT_SPIN_ACQUIRE); | |
583 | #endif | |
584 | ||
1c79356b A |
585 | return (0); |
586 | } |