2 * Copyright (c) 2000-2010 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
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
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
32 * Mach Operating System
33 * Copyright (c) 1991,1990 Carnegie Mellon University
34 * All Rights Reserved.
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.
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.
46 * Carnegie Mellon requests users of this software to return to
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
57 #include <platforms.h>
59 #include <mach_ldebug.h>
60 #include <stat_time.h>
63 * Pass field offsets to assembly code.
66 #include <kern/thread.h>
67 #include <kern/task.h>
68 #include <kern/lock.h>
69 #include <kern/locks.h>
70 #include <kern/host.h>
71 #include <kern/misc_protos.h>
72 #include <ipc/ipc_space.h>
73 #include <ipc/ipc_port.h>
74 #include <ipc/ipc_pset.h>
75 #include <vm/vm_map.h>
76 #include <i386/pmap.h>
77 #include <i386/Diagnostics.h>
78 #include <i386/mp_desc.h>
80 #include <i386/thread.h>
81 #include <i386/cpu_data.h>
83 #include <i386/cpu_capabilities.h>
84 #include <i386/cpuid.h>
85 #include <i386/pmCPU.h>
86 #include <mach/i386/vm_param.h>
87 #include <mach/i386/thread_status.h>
88 #include <machine/commpage.h>
89 #include <pexpert/i386/boot.h>
92 #define NEED_DTRACE_DEFS
93 #include <../bsd/sys/lockstat.h>
97 * genassym.c is used to produce an
98 * assembly file which, intermingled with unuseful assembly code,
99 * has all the necessary definitions emitted. This assembly file is
100 * then postprocessed with sed to extract only these definitions
101 * and thus the final assyms.s is created.
103 * This convoluted means is necessary since the structure alignment
104 * and packing may be different between the host machine and the
105 * target so we are forced into using the cross compiler to generate
106 * the values, but we cannot run anything on the target machine.
110 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE)0)->MEMBER)
113 #define DECLARE(SYM,VAL) \
114 __asm("#DEFINITION#\t.set\t" SYM ",\t%0" : : "n" ((u_int)(VAL)))
116 #define DECLARE(SYM,VAL) \
117 __asm("#DEFINITION##define " SYM "\t%0" : : "n" ((u_int)(VAL)))
130 DECLARE("AST_URGENT", AST_URGENT
);
131 DECLARE("AST_BSD", AST_BSD
);
133 DECLARE("MAX_CPUS", MAX_CPUS
);
135 /* Simple Lock structure */
136 DECLARE("SLOCK_ILK", offsetof(usimple_lock_t
, interlock
));
138 DECLARE("SLOCK_TYPE", offsetof(usimple_lock_t
, lock_type
));
139 DECLARE("SLOCK_PC", offsetof(usimple_lock_t
, debug
.lock_pc
));
140 DECLARE("SLOCK_THREAD", offsetof(usimple_lock_t
, debug
.lock_thread
));
141 DECLARE("SLOCK_DURATIONH",offsetof(usimple_lock_t
, debug
.duration
[0]));
142 DECLARE("SLOCK_DURATIONL",offsetof(usimple_lock_t
, debug
.duration
[1]));
143 DECLARE("USLOCK_TAG", USLOCK_TAG
);
144 #endif /* MACH_LDEBUG */
146 /* Mutex structure */
147 DECLARE("MUTEX_OWNER", offsetof(lck_mtx_t
*, lck_mtx_owner
));
148 DECLARE("MUTEX_PTR", offsetof(lck_mtx_t
*, lck_mtx_ptr
));
149 DECLARE("MUTEX_STATE", offsetof(lck_mtx_t
*, lck_mtx_state
));
151 DECLARE("MUTEX_TYPE", offsetof(lck_mtx_ext_t
*, lck_mtx_deb
.type
));
152 DECLARE("MUTEX_PC", offsetof(lck_mtx_ext_t
*, lck_mtx_deb
.pc
));
153 DECLARE("MUTEX_ATTR", offsetof(lck_mtx_ext_t
*, lck_mtx_attr
));
154 DECLARE("MUTEX_ATTR_DEBUG", LCK_MTX_ATTR_DEBUG
);
155 DECLARE("MUTEX_ATTR_DEBUGb", LCK_MTX_ATTR_DEBUGb
);
156 DECLARE("MUTEX_ATTR_STAT", LCK_MTX_ATTR_STAT
);
157 DECLARE("MUTEX_ATTR_STATb", LCK_MTX_ATTR_STATb
);
158 DECLARE("MUTEX_TAG", MUTEX_TAG
);
160 DECLARE("MUTEX_IND", LCK_MTX_TAG_INDIRECT
);
161 DECLARE("MUTEX_PTR", offsetof(lck_mtx_t
*, lck_mtx_ptr
));
162 DECLARE("MUTEX_ASSERT_OWNED", LCK_MTX_ASSERT_OWNED
);
163 DECLARE("MUTEX_ASSERT_NOTOWNED",LCK_MTX_ASSERT_NOTOWNED
);
164 DECLARE("GRP_MTX_STAT_UTIL", offsetof(lck_grp_t
*, lck_grp_stat
.lck_grp_mtx_stat
.lck_grp_mtx_util_cnt
));
165 DECLARE("GRP_MTX_STAT_MISS", offsetof(lck_grp_t
*, lck_grp_stat
.lck_grp_mtx_stat
.lck_grp_mtx_miss_cnt
));
166 DECLARE("GRP_MTX_STAT_WAIT", offsetof(lck_grp_t
*, lck_grp_stat
.lck_grp_mtx_stat
.lck_grp_mtx_wait_cnt
));
169 DECLARE("MUTEX_DESTROYED", LCK_MTX_TAG_DESTROYED
);
171 /* Per-mutex statistic element */
172 DECLARE("MTX_ACQ_TSC", offsetof(lck_mtx_ext_t
*, lck_mtx_stat
));
174 /* Mutex group statistics elements */
175 DECLARE("MUTEX_GRP", offsetof(lck_mtx_ext_t
*, lck_mtx_grp
));
178 * The use of this field is somewhat at variance with the alias.
180 DECLARE("GRP_MTX_STAT_DIRECT_WAIT", offsetof(lck_grp_t
*, lck_grp_stat
.lck_grp_mtx_stat
.lck_grp_mtx_held_cnt
));
182 DECLARE("GRP_MTX_STAT_HELD_MAX", offsetof(lck_grp_t
*, lck_grp_stat
.lck_grp_mtx_stat
.lck_grp_mtx_held_max
));
183 /* Reader writer lock types */
184 DECLARE("RW_SHARED", LCK_RW_TYPE_SHARED
);
185 DECLARE("RW_EXCL", LCK_RW_TYPE_EXCLUSIVE
);
187 DECLARE("TH_RECOVER", offsetof(thread_t
, recover
));
188 DECLARE("TH_CONTINUATION", offsetof(thread_t
, continuation
));
189 DECLARE("TH_KERNEL_STACK", offsetof(thread_t
, kernel_stack
));
190 DECLARE("TH_MUTEX_COUNT", offsetof(thread_t
, mutex_count
));
191 DECLARE("TH_WAS_PROMOTED_ON_WAKEUP", offsetof(thread_t
, was_promoted_on_wakeup
));
193 DECLARE("TH_SYSCALLS_MACH", offsetof(thread_t
, syscalls_mach
));
194 DECLARE("TH_SYSCALLS_UNIX", offsetof(thread_t
, syscalls_unix
));
196 DECLARE("TASK_VTIMERS", offsetof(struct task
*, vtimers
));
198 /* These fields are being added on demand */
199 DECLARE("TH_TASK", offsetof(thread_t
, task
));
200 DECLARE("TH_AST", offsetof(thread_t
, ast
));
201 DECLARE("TH_MAP", offsetof(thread_t
, map
));
202 DECLARE("TH_SPF", offsetof(thread_t
, machine
.specFlags
));
203 DECLARE("TH_PCB_ISS", offsetof(thread_t
, machine
.iss
));
204 DECLARE("TH_PCB_IDS", offsetof(thread_t
, machine
.ids
));
205 DECLARE("TH_PCB_FPS", offsetof(thread_t
, machine
.ifps
));
206 #if NCOPY_WINDOWS > 0
207 DECLARE("TH_COPYIO_STATE", offsetof(thread_t
, machine
.copyio_state
));
208 DECLARE("WINDOWS_CLEAN", WINDOWS_CLEAN
);
211 DECLARE("MAP_PMAP", offsetof(vm_map_t
, pmap
));
213 #define IEL_SIZE (sizeof(struct i386_exception_link *))
214 DECLARE("IKS_SIZE", sizeof(struct x86_kernel_state
));
217 * KSS_* are offsets from the top of the kernel stack (cpu_kernel_stack)
219 #if defined(__i386__)
220 DECLARE("KSS_EBX", offsetof(struct x86_kernel_state
*, k_ebx
));
221 DECLARE("KSS_ESP", offsetof(struct x86_kernel_state
*, k_esp
));
222 DECLARE("KSS_EBP", offsetof(struct x86_kernel_state
*, k_ebp
));
223 DECLARE("KSS_EDI", offsetof(struct x86_kernel_state
*, k_edi
));
224 DECLARE("KSS_ESI", offsetof(struct x86_kernel_state
*, k_esi
));
225 DECLARE("KSS_EIP", offsetof(struct x86_kernel_state
*, k_eip
));
226 #elif defined(__x86_64__)
227 DECLARE("KSS_RBX", offsetof(struct x86_kernel_state
*, k_rbx
));
228 DECLARE("KSS_RSP", offsetof(struct x86_kernel_state
*, k_rsp
));
229 DECLARE("KSS_RBP", offsetof(struct x86_kernel_state
*, k_rbp
));
230 DECLARE("KSS_R12", offsetof(struct x86_kernel_state
*, k_r12
));
231 DECLARE("KSS_R13", offsetof(struct x86_kernel_state
*, k_r13
));
232 DECLARE("KSS_R14", offsetof(struct x86_kernel_state
*, k_r14
));
233 DECLARE("KSS_R15", offsetof(struct x86_kernel_state
*, k_r15
));
234 DECLARE("KSS_RIP", offsetof(struct x86_kernel_state
*, k_rip
));
236 #error Unsupported architecture
239 DECLARE("DS_DR0", offsetof(struct x86_debug_state32
*, dr0
));
240 DECLARE("DS_DR1", offsetof(struct x86_debug_state32
*, dr1
));
241 DECLARE("DS_DR2", offsetof(struct x86_debug_state32
*, dr2
));
242 DECLARE("DS_DR3", offsetof(struct x86_debug_state32
*, dr3
));
243 DECLARE("DS_DR4", offsetof(struct x86_debug_state32
*, dr4
));
244 DECLARE("DS_DR5", offsetof(struct x86_debug_state32
*, dr5
));
245 DECLARE("DS_DR6", offsetof(struct x86_debug_state32
*, dr6
));
246 DECLARE("DS_DR7", offsetof(struct x86_debug_state32
*, dr7
));
248 DECLARE("DS64_DR0", offsetof(struct x86_debug_state64
*, dr0
));
249 DECLARE("DS64_DR1", offsetof(struct x86_debug_state64
*, dr1
));
250 DECLARE("DS64_DR2", offsetof(struct x86_debug_state64
*, dr2
));
251 DECLARE("DS64_DR3", offsetof(struct x86_debug_state64
*, dr3
));
252 DECLARE("DS64_DR4", offsetof(struct x86_debug_state64
*, dr4
));
253 DECLARE("DS64_DR5", offsetof(struct x86_debug_state64
*, dr5
));
254 DECLARE("DS64_DR6", offsetof(struct x86_debug_state64
*, dr6
));
255 DECLARE("DS64_DR7", offsetof(struct x86_debug_state64
*, dr7
));
257 DECLARE("FP_VALID", offsetof(struct x86_fx_thread_state
*,fp_valid
));
259 DECLARE("SS_FLAVOR", offsetof(x86_saved_state_t
*, flavor
));
260 DECLARE("SS_32", x86_SAVED_STATE32
);
261 DECLARE("SS_64", x86_SAVED_STATE64
);
263 #define R_(x) offsetof(x86_saved_state_t *, ss_32.x)
264 DECLARE("R32_CS", R_(cs
));
265 DECLARE("R32_SS", R_(ss
));
266 DECLARE("R32_DS", R_(ds
));
267 DECLARE("R32_ES", R_(es
));
268 DECLARE("R32_FS", R_(fs
));
269 DECLARE("R32_GS", R_(gs
));
270 DECLARE("R32_UESP", R_(uesp
));
271 DECLARE("R32_EBP", R_(ebp
));
272 DECLARE("R32_EAX", R_(eax
));
273 DECLARE("R32_EBX", R_(ebx
));
274 DECLARE("R32_ECX", R_(ecx
));
275 DECLARE("R32_EDX", R_(edx
));
276 DECLARE("R32_ESI", R_(esi
));
277 DECLARE("R32_EDI", R_(edi
));
278 DECLARE("R32_TRAPNO", R_(trapno
));
279 DECLARE("R32_ERR", R_(err
));
280 DECLARE("R32_EFLAGS", R_(efl
));
281 DECLARE("R32_EIP", R_(eip
));
282 DECLARE("R32_CR2", R_(cr2
));
283 DECLARE("ISS32_SIZE", sizeof (x86_saved_state32_t
));
285 #define R64_(x) offsetof(x86_saved_state_t *, ss_64.x)
286 DECLARE("R64_FS", R64_(fs
));
287 DECLARE("R64_GS", R64_(gs
));
288 DECLARE("R64_R8", R64_(r8
));
289 DECLARE("R64_R9", R64_(r9
));
290 DECLARE("R64_R10", R64_(r10
));
291 DECLARE("R64_R11", R64_(r11
));
292 DECLARE("R64_R12", R64_(r12
));
293 DECLARE("R64_R13", R64_(r13
));
294 DECLARE("R64_R14", R64_(r14
));
295 DECLARE("R64_R15", R64_(r15
));
296 DECLARE("R64_RBP", R64_(rbp
));
297 DECLARE("R64_RAX", R64_(rax
));
298 DECLARE("R64_RBX", R64_(rbx
));
299 DECLARE("R64_RCX", R64_(rcx
));
300 DECLARE("R64_RDX", R64_(rdx
));
301 DECLARE("R64_RSI", R64_(rsi
));
302 DECLARE("R64_RDI", R64_(rdi
));
303 DECLARE("R64_V_ARG6", R64_(v_arg6
));
304 DECLARE("R64_V_ARG7", R64_(v_arg7
));
305 DECLARE("R64_V_ARG8", R64_(v_arg8
));
306 DECLARE("R64_CS", R64_(isf
.cs
));
307 DECLARE("R64_SS", R64_(isf
.ss
));
308 DECLARE("R64_RSP", R64_(isf
.rsp
));
309 DECLARE("R64_TRAPNO", R64_(isf
.trapno
));
310 DECLARE("R64_TRAPFN", R64_(isf
.trapfn
));
311 DECLARE("R64_ERR", R64_(isf
.err
));
312 DECLARE("R64_RFLAGS", R64_(isf
.rflags
));
313 DECLARE("R64_RIP", R64_(isf
.rip
));
314 DECLARE("R64_CR2", R64_(cr2
));
315 DECLARE("ISS64_OFFSET", R64_(isf
));
316 DECLARE("ISS64_SIZE", sizeof (x86_saved_state64_t
));
318 #define ISF64_(x) offsetof(x86_64_intr_stack_frame_t *, x)
319 DECLARE("ISF64_TRAPNO", ISF64_(trapno
));
320 DECLARE("ISF64_TRAPFN", ISF64_(trapfn
));
321 DECLARE("ISF64_ERR", ISF64_(err
));
322 DECLARE("ISF64_RIP", ISF64_(rip
));
323 DECLARE("ISF64_CS", ISF64_(cs
));
324 DECLARE("ISF64_RFLAGS", ISF64_(rflags
));
325 DECLARE("ISF64_RSP", ISF64_(rsp
));
326 DECLARE("ISF64_SS", ISF64_(ss
));
327 DECLARE("ISF64_SIZE", sizeof(x86_64_intr_stack_frame_t
));
329 DECLARE("ISC32_OFFSET", offsetof(x86_saved_state_compat32_t
*, isf64
));
330 #define ISC32_(x) offsetof(x86_saved_state_compat32_t *, isf64.x)
331 DECLARE("ISC32_TRAPNO", ISC32_(trapno
));
332 DECLARE("ISC32_TRAPFN", ISC32_(trapfn
));
333 DECLARE("ISC32_ERR", ISC32_(err
));
334 DECLARE("ISC32_RIP", ISC32_(rip
));
335 DECLARE("ISC32_CS", ISC32_(cs
));
336 DECLARE("ISC32_RFLAGS", ISC32_(rflags
));
337 DECLARE("ISC32_RSP", ISC32_(rsp
));
338 DECLARE("ISC32_SS", ISC32_(ss
));
340 DECLARE("NBPG", I386_PGBYTES
);
341 DECLARE("PAGE_SIZE", I386_PGBYTES
);
342 DECLARE("PAGE_MASK", I386_PGBYTES
-1);
343 DECLARE("PAGE_SHIFT", 12);
344 DECLARE("NKPT", NKPT
);
346 DECLARE("KPTDI", KPTDI
);
348 DECLARE("VM_MIN_ADDRESS", VM_MIN_ADDRESS
);
349 DECLARE("VM_MAX_ADDRESS", VM_MAX_ADDRESS
);
350 DECLARE("KERNELBASE", VM_MIN_KERNEL_ADDRESS
);
351 DECLARE("LINEAR_KERNELBASE", LINEAR_KERNEL_ADDRESS
);
352 DECLARE("KERNEL_STACK_SIZE", KERNEL_STACK_SIZE
);
354 DECLARE("KERNEL_UBER_BASE_HI32", KERNEL_UBER_BASE_HI32
);
357 DECLARE("ASM_COMM_PAGE32_BASE_ADDRESS", _COMM_PAGE32_BASE_ADDRESS
);
358 DECLARE("ASM_COMM_PAGE32_START_ADDRESS", _COMM_PAGE32_START_ADDRESS
);
359 DECLARE("ASM_COMM_PAGE_SCHED_GEN", _COMM_PAGE_SCHED_GEN
);
361 DECLARE("PDESHIFT", PDESHIFT
);
362 DECLARE("PTEMASK", PTEMASK
);
363 DECLARE("PTEINDX", PTEINDX
);
364 DECLARE("INTEL_PTE_PFN", INTEL_PTE_PFN
);
365 DECLARE("INTEL_PTE_VALID", INTEL_PTE_VALID
);
366 DECLARE("INTEL_PTE_WRITE", INTEL_PTE_WRITE
);
367 DECLARE("INTEL_PTE_PS", INTEL_PTE_PS
);
368 DECLARE("INTEL_PTE_USER", INTEL_PTE_USER
);
369 DECLARE("INTEL_PTE_INVALID", INTEL_PTE_INVALID
);
370 DECLARE("NPGPTD", NPGPTD
);
371 #if defined(__x86_64__)
372 DECLARE("INITPT_SEG_BASE",INITPT_SEG_BASE
);
373 DECLARE("INITGDT_SEG_BASE",INITGDT_SEG_BASE
);
374 DECLARE("SLEEP_SEG_BASE",SLEEP_SEG_BASE
);
375 DECLARE("PROT_MODE_GDT_SIZE",PROT_MODE_GDT_SIZE
);
376 DECLARE("KERNEL_PML4_INDEX",KERNEL_PML4_INDEX
);
378 DECLARE("IDTSZ", IDTSZ
);
379 DECLARE("GDTSZ", GDTSZ
);
380 DECLARE("LDTSZ", LDTSZ
);
382 DECLARE("KERNEL_DS", KERNEL_DS
);
383 DECLARE("USER_CS", USER_CS
);
384 DECLARE("USER_DS", USER_DS
);
385 DECLARE("KERNEL32_CS", KERNEL32_CS
);
386 DECLARE("KERNEL64_CS", KERNEL64_CS
);
387 DECLARE("USER64_CS", USER64_CS
);
388 DECLARE("KERNEL_TSS", KERNEL_TSS
);
389 DECLARE("KERNEL_LDT", KERNEL_LDT
);
391 DECLARE("DF_TSS", DF_TSS
);
392 DECLARE("MC_TSS", MC_TSS
);
394 DECLARE("DEBUG_TSS", DEBUG_TSS
);
395 #endif /* MACH_KDB */
396 DECLARE("CPU_DATA_GS", CPU_DATA_GS
);
397 #endif /* __i386__ */
398 DECLARE("SYSENTER_CS", SYSENTER_CS
);
399 DECLARE("SYSENTER_TF_CS",SYSENTER_TF_CS
);
400 DECLARE("SYSENTER_DS", SYSENTER_DS
);
401 DECLARE("SYSCALL_CS", SYSCALL_CS
);
403 DECLARE("USER_WINDOW_SEL", USER_WINDOW_SEL
);
404 DECLARE("PHYS_WINDOW_SEL", PHYS_WINDOW_SEL
);
408 offsetof(cpu_data_t
*, cpu_this
));
409 DECLARE("CPU_ACTIVE_THREAD",
410 offsetof(cpu_data_t
*, cpu_active_thread
));
411 DECLARE("CPU_ACTIVE_STACK",
412 offsetof(cpu_data_t
*, cpu_active_stack
));
413 DECLARE("CPU_KERNEL_STACK",
414 offsetof(cpu_data_t
*, cpu_kernel_stack
));
415 DECLARE("CPU_INT_STACK_TOP",
416 offsetof(cpu_data_t
*, cpu_int_stack_top
));
418 DECLARE("CPU_PREEMPTION_LEVEL",
419 offsetof(cpu_data_t
*, cpu_preemption_level
));
421 DECLARE("CPU_HIBERNATE",
422 offsetof(cpu_data_t
*, cpu_hibernate
));
423 DECLARE("CPU_INTERRUPT_LEVEL",
424 offsetof(cpu_data_t
*, cpu_interrupt_level
));
425 DECLARE("CPU_NESTED_ISTACK",
426 offsetof(cpu_data_t
*, cpu_nested_istack
));
427 DECLARE("CPU_NUMBER_GS",
428 offsetof(cpu_data_t
*,cpu_number
));
429 DECLARE("CPU_RUNNING",
430 offsetof(cpu_data_t
*,cpu_running
));
431 DECLARE("CPU_MCOUNT_OFF",
432 offsetof(cpu_data_t
*,cpu_mcount_off
));
433 DECLARE("CPU_PENDING_AST",
434 offsetof(cpu_data_t
*,cpu_pending_ast
));
435 DECLARE("CPU_DESC_TABLEP",
436 offsetof(cpu_data_t
*,cpu_desc_tablep
));
437 DECLARE("CPU_DESC_INDEX",
438 offsetof(cpu_data_t
*,cpu_desc_index
));
440 offsetof(cpu_desc_index_t
*,cdi_gdt
));
442 offsetof(cpu_desc_index_t
*,cdi_idt
));
443 DECLARE("CPU_PROCESSOR",
444 offsetof(cpu_data_t
*,cpu_processor
));
445 DECLARE("CPU_INT_STATE",
446 offsetof(cpu_data_t
*, cpu_int_state
));
447 DECLARE("CPU_INT_EVENT_TIME",
448 offsetof(cpu_data_t
*, cpu_int_event_time
));
451 DECLARE("CPU_HI_ISS",
452 offsetof(cpu_data_t
*, cpu_hi_iss
));
454 DECLARE("CPU_TASK_CR3",
455 offsetof(cpu_data_t
*, cpu_task_cr3
));
456 DECLARE("CPU_ACTIVE_CR3",
457 offsetof(cpu_data_t
*, cpu_active_cr3
));
458 DECLARE("CPU_KERNEL_CR3",
459 offsetof(cpu_data_t
*, cpu_kernel_cr3
));
461 DECLARE("CPU_TLB_INVALID",
462 offsetof(cpu_data_t
*, cpu_tlb_invalid
));
465 DECLARE("CPU_IS64BIT",
466 offsetof(cpu_data_t
*, cpu_is64bit
));
467 DECLARE("CPU_TASK_MAP",
468 offsetof(cpu_data_t
*, cpu_task_map
));
469 DECLARE("TASK_MAP_32BIT", TASK_MAP_32BIT
);
470 DECLARE("TASK_MAP_64BIT", TASK_MAP_64BIT
);
472 DECLARE("TASK_MAP_64BIT_SHARED", TASK_MAP_64BIT_SHARED
);
474 DECLARE("CPU_UBER_USER_GS_BASE",
475 offsetof(cpu_data_t
*, cpu_uber
.cu_user_gs_base
));
476 DECLARE("CPU_UBER_ISF",
477 offsetof(cpu_data_t
*, cpu_uber
.cu_isf
));
478 DECLARE("CPU_UBER_TMP",
479 offsetof(cpu_data_t
*, cpu_uber
.cu_tmp
));
480 DECLARE("CPU_UBER_ARG_STORE",
481 offsetof(cpu_data_t
*, cpu_uber_arg_store
));
482 DECLARE("CPU_UBER_ARG_STORE_VALID",
483 offsetof(cpu_data_t
*, cpu_uber_arg_store_valid
));
485 DECLARE("CPU_NANOTIME",
486 offsetof(cpu_data_t
*, cpu_nanotime
));
489 offsetof(cpu_data_t
*, cpu_dr7
));
491 DECLARE("hwIntCnt", offsetof(cpu_data_t
*,cpu_hwIntCnt
));
492 #if defined(__x86_64__)
493 DECLARE("CPU_ACTIVE_PCID",
494 offsetof(cpu_data_t
*, cpu_active_pcid
));
495 DECLARE("CPU_PCID_COHERENTP",
496 offsetof(cpu_data_t
*, cpu_pmap_pcid_coherentp
));
497 DECLARE("CPU_PCID_COHERENTP_KERNEL",
498 offsetof(cpu_data_t
*, cpu_pmap_pcid_coherentp_kernel
));
499 DECLARE("CPU_PMAP_PCID_ENABLED",
500 offsetof(cpu_data_t
*, cpu_pmap_pcid_enabled
));
503 DECLARE("CPU_PMAP_USER_RETS",
504 offsetof(cpu_data_t
*, cpu_pmap_user_rets
));
505 DECLARE("CPU_PMAP_PCID_PRESERVES",
506 offsetof(cpu_data_t
*, cpu_pmap_pcid_preserves
));
507 DECLARE("CPU_PMAP_PCID_FLUSHES",
508 offsetof(cpu_data_t
*, cpu_pmap_pcid_flushes
));
510 DECLARE("CPU_TLB_INVALID",
511 offsetof(cpu_data_t
*, cpu_tlb_invalid
));
512 DECLARE("CPU_TLB_INVALID_LOCAL",
513 offsetof(cpu_data_t
*, cpu_tlb_invalid_local
));
514 DECLARE("CPU_TLB_INVALID_GLOBAL",
515 offsetof(cpu_data_t
*, cpu_tlb_invalid_global
));
517 DECLARE("enaExpTrace", enaExpTrace
);
518 DECLARE("enaExpTraceb", enaExpTraceb
);
519 DECLARE("enaUsrFCall", enaUsrFCall
);
520 DECLARE("enaUsrFCallb", enaUsrFCallb
);
521 DECLARE("enaUsrPhyMp", enaUsrPhyMp
);
522 DECLARE("enaUsrPhyMpb", enaUsrPhyMpb
);
523 DECLARE("enaDiagSCs", enaDiagSCs
);
524 DECLARE("enaDiagSCsb", enaDiagSCsb
);
525 DECLARE("enaDiagEM", enaDiagEM
);
526 DECLARE("enaDiagEMb", enaDiagEMb
);
527 DECLARE("enaNotifyEM", enaNotifyEM
);
528 DECLARE("enaNotifyEMb", enaNotifyEMb
);
529 DECLARE("dgLock", offsetof(struct diagWork
*, dgLock
));
530 DECLARE("dgFlags", offsetof(struct diagWork
*, dgFlags
));
531 DECLARE("dgMisc1", offsetof(struct diagWork
*, dgMisc1
));
532 DECLARE("dgMisc2", offsetof(struct diagWork
*, dgMisc2
));
533 DECLARE("dgMisc3", offsetof(struct diagWork
*, dgMisc3
));
534 DECLARE("dgMisc4", offsetof(struct diagWork
*, dgMisc4
));
535 DECLARE("dgMisc5", offsetof(struct diagWork
*, dgMisc5
));
537 DECLARE("INTEL_PTE_KERNEL", INTEL_PTE_VALID
|INTEL_PTE_WRITE
);
538 DECLARE("PDESHIFT", PDESHIFT
);
539 DECLARE("PDESIZE", PDESIZE
);
540 DECLARE("PTESIZE", PTESIZE
);
542 DECLARE("PTDPTDI", PTDPTDI
);
543 DECLARE("APTDPTDI", APTDPTDI
);
544 DECLARE("HIGH_MEM_BASE", HIGH_MEM_BASE
);
545 DECLARE("HIGH_IDT_BASE", pmap_index_to_virt(HIGH_FIXED_IDT
));
548 DECLARE("KERNELBASEPDE",
549 (LINEAR_KERNEL_ADDRESS
>> PDESHIFT
) *
552 DECLARE("TSS_ESP0", offsetof(struct i386_tss
*, esp0
));
553 DECLARE("TSS_SS0", offsetof(struct i386_tss
*, ss0
));
554 DECLARE("TSS_LDT", offsetof(struct i386_tss
*, ldt
));
555 DECLARE("TSS_PDBR", offsetof(struct i386_tss
*, cr3
));
556 DECLARE("TSS_LINK", offsetof(struct i386_tss
*, back_link
));
558 DECLARE("K_TASK_GATE", ACC_P
|ACC_PL_K
|ACC_TASK_GATE
);
559 DECLARE("K_TRAP_GATE", ACC_P
|ACC_PL_K
|ACC_TRAP_GATE
);
560 DECLARE("U_TRAP_GATE", ACC_P
|ACC_PL_U
|ACC_TRAP_GATE
);
561 DECLARE("K_INTR_GATE", ACC_P
|ACC_PL_K
|ACC_INTR_GATE
);
562 DECLARE("U_INTR_GATE", ACC_P
|ACC_PL_U
|ACC_INTR_GATE
);
563 DECLARE("K_TSS", ACC_P
|ACC_PL_K
|ACC_TSS
);
566 * usimple_lock fields
568 DECLARE("USL_INTERLOCK", offsetof(usimple_lock_t
, interlock
));
570 DECLARE("INTSTACK_SIZE", INTSTACK_SIZE
);
571 DECLARE("KADDR", offsetof(struct boot_args
*, kaddr
));
572 DECLARE("KSIZE", offsetof(struct boot_args
*, ksize
));
573 DECLARE("MEMORYMAP", offsetof(struct boot_args
*, MemoryMap
));
574 DECLARE("DEVICETREEP", offsetof(struct boot_args
*, deviceTreeP
));
576 DECLARE("RNT_TSC_BASE",
577 offsetof(pal_rtc_nanotime_t
*, tsc_base
));
578 DECLARE("RNT_NS_BASE",
579 offsetof(pal_rtc_nanotime_t
*, ns_base
));
581 offsetof(pal_rtc_nanotime_t
*, scale
));
583 offsetof(pal_rtc_nanotime_t
*, shift
));
584 DECLARE("RNT_GENERATION",
585 offsetof(pal_rtc_nanotime_t
*, generation
));
587 /* values from kern/timer.h */
589 DECLARE("TIMER_ALL", offsetof(struct timer
*, all_bits
));
591 DECLARE("TIMER_LOW", offsetof(struct timer
*, low_bits
));
592 DECLARE("TIMER_HIGH", offsetof(struct timer
*, high_bits
));
593 DECLARE("TIMER_HIGHCHK", offsetof(struct timer
*, high_bits_check
));
596 DECLARE("TIMER_TSTAMP",
597 offsetof(struct timer
*, tstamp
));
599 DECLARE("THREAD_TIMER",
600 offsetof(struct processor
*, processor_data
.thread_timer
));
602 DECLARE("KERNEL_TIMER",
603 offsetof(struct processor
*, processor_data
.kernel_timer
));
604 DECLARE("SYSTEM_TIMER",
605 offsetof(struct thread
*, system_timer
));
606 DECLARE("USER_TIMER",
607 offsetof(struct thread
*, user_timer
));
608 DECLARE("SYSTEM_STATE",
609 offsetof(struct processor
*, processor_data
.system_state
));
610 DECLARE("USER_STATE",
611 offsetof(struct processor
*, processor_data
.user_state
));
612 DECLARE("IDLE_STATE",
613 offsetof(struct processor
*, processor_data
.idle_state
));
614 DECLARE("CURRENT_STATE",
615 offsetof(struct processor
*, processor_data
.current_state
));
617 DECLARE("OnProc", OnProc
);
621 DECLARE("LS_LCK_MTX_LOCK_ACQUIRE", LS_LCK_MTX_LOCK_ACQUIRE
);
622 DECLARE("LS_LCK_MTX_TRY_SPIN_LOCK_ACQUIRE", LS_LCK_MTX_TRY_SPIN_LOCK_ACQUIRE
);
623 DECLARE("LS_LCK_MTX_UNLOCK_RELEASE", LS_LCK_MTX_UNLOCK_RELEASE
);
624 DECLARE("LS_LCK_MTX_TRY_LOCK_ACQUIRE", LS_LCK_MTX_TRY_LOCK_ACQUIRE
);
625 DECLARE("LS_LCK_RW_LOCK_SHARED_ACQUIRE", LS_LCK_RW_LOCK_SHARED_ACQUIRE
);
626 DECLARE("LS_LCK_RW_DONE_RELEASE", LS_LCK_RW_DONE_RELEASE
);
627 DECLARE("LS_LCK_MTX_EXT_LOCK_ACQUIRE", LS_LCK_MTX_EXT_LOCK_ACQUIRE
);
628 DECLARE("LS_LCK_MTX_TRY_EXT_LOCK_ACQUIRE", LS_LCK_MTX_TRY_EXT_LOCK_ACQUIRE
);
629 DECLARE("LS_LCK_MTX_EXT_UNLOCK_RELEASE", LS_LCK_MTX_EXT_UNLOCK_RELEASE
);
630 DECLARE("LS_LCK_RW_LOCK_EXCL_ACQUIRE", LS_LCK_RW_LOCK_EXCL_ACQUIRE
);
631 DECLARE("LS_LCK_RW_LOCK_SHARED_TO_EXCL_UPGRADE", LS_LCK_RW_LOCK_SHARED_TO_EXCL_UPGRADE
);
632 DECLARE("LS_LCK_RW_TRY_LOCK_EXCL_ACQUIRE", LS_LCK_RW_TRY_LOCK_EXCL_ACQUIRE
);
633 DECLARE("LS_LCK_RW_TRY_LOCK_SHARED_ACQUIRE", LS_LCK_RW_TRY_LOCK_SHARED_ACQUIRE
);
634 DECLARE("LS_LCK_MTX_LOCK_SPIN_ACQUIRE", LS_LCK_MTX_LOCK_SPIN_ACQUIRE
);