- DECLARE("ACT_MACH_EXC_PORT",
- offsetof(thread_t, exc_actions[EXC_MACH_SYSCALL].port));
-
- DECLARE("ACT_TASK", offsetof(thread_t, task));
- DECLARE("ACT_AST", offsetof(thread_t, ast));
- DECLARE("ACT_PCB", offsetof(thread_t, machine.pcb));
- DECLARE("ACT_SPF", offsetof(thread_t, machine.specFlags));
- DECLARE("ACT_MAP", offsetof(thread_t, map));
- DECLARE("ACT_COPYIO_STATE", offsetof(thread_t, machine.copyio_state));
- DECLARE("ACT_PCB_ISS", offsetof(thread_t, machine.xxx_pcb.iss));
- DECLARE("ACT_PCB_IDS", offsetof(thread_t, machine.xxx_pcb.ids));
-
- DECLARE("WINDOWS_CLEAN", WINDOWS_CLEAN);
-
- DECLARE("MAP_PMAP", offsetof(vm_map_t, pmap));
-
-#define IKS ((size_t) (STACK_IKS(0)))
-
- DECLARE("KSS_EBX", IKS + offsetof(struct x86_kernel_state32 *, k_ebx));
- DECLARE("KSS_ESP", IKS + offsetof(struct x86_kernel_state32 *, k_esp));
- DECLARE("KSS_EBP", IKS + offsetof(struct x86_kernel_state32 *, k_ebp));
- DECLARE("KSS_EDI", IKS + offsetof(struct x86_kernel_state32 *, k_edi));
- DECLARE("KSS_ESI", IKS + offsetof(struct x86_kernel_state32 *, k_esi));
- DECLARE("KSS_EIP", IKS + offsetof(struct x86_kernel_state32 *, k_eip));
-
- DECLARE("IKS_SIZE", sizeof(struct x86_kernel_state32));
- DECLARE("IEL_SIZE", sizeof(struct i386_exception_link));
-
- DECLARE("PCB_FPS", offsetof(pcb_t, ifps));
- DECLARE("PCB_ISS", offsetof(pcb_t, iss));
-
- DECLARE("DS_DR0", offsetof(struct x86_debug_state32 *, dr0));
- DECLARE("DS_DR1", offsetof(struct x86_debug_state32 *, dr1));
- DECLARE("DS_DR2", offsetof(struct x86_debug_state32 *, dr2));
- DECLARE("DS_DR3", offsetof(struct x86_debug_state32 *, dr3));
- DECLARE("DS_DR4", offsetof(struct x86_debug_state32 *, dr4));
- DECLARE("DS_DR5", offsetof(struct x86_debug_state32 *, dr5));
- DECLARE("DS_DR6", offsetof(struct x86_debug_state32 *, dr6));
- DECLARE("DS_DR7", offsetof(struct x86_debug_state32 *, dr7));
-
- DECLARE("DS64_DR0", offsetof(struct x86_debug_state64 *, dr0));
- DECLARE("DS64_DR1", offsetof(struct x86_debug_state64 *, dr1));
- DECLARE("DS64_DR2", offsetof(struct x86_debug_state64 *, dr2));
- DECLARE("DS64_DR3", offsetof(struct x86_debug_state64 *, dr3));
- DECLARE("DS64_DR4", offsetof(struct x86_debug_state64 *, dr4));
- DECLARE("DS64_DR5", offsetof(struct x86_debug_state64 *, dr5));
- DECLARE("DS64_DR6", offsetof(struct x86_debug_state64 *, dr6));
- DECLARE("DS64_DR7", offsetof(struct x86_debug_state64 *, dr7));
-
- DECLARE("FP_VALID", offsetof(struct x86_fpsave_state *,fp_valid));
-
- DECLARE("SS_FLAVOR", offsetof(x86_saved_state_t *, flavor));
- DECLARE("SS_32", x86_SAVED_STATE32);
- DECLARE("SS_64", x86_SAVED_STATE64);
-
-#define R_(x) offsetof(x86_saved_state_t *, ss_32.x)
- DECLARE("R_CS", R_(cs));
- DECLARE("R_SS", R_(ss));
- DECLARE("R_DS", R_(ds));
- DECLARE("R_ES", R_(es));
- DECLARE("R_FS", R_(fs));
- DECLARE("R_GS", R_(gs));
- DECLARE("R_UESP", R_(uesp));
- DECLARE("R_EBP", R_(ebp));
- DECLARE("R_EAX", R_(eax));
- DECLARE("R_EBX", R_(ebx));
- DECLARE("R_ECX", R_(ecx));
- DECLARE("R_EDX", R_(edx));
- DECLARE("R_ESI", R_(esi));
- DECLARE("R_EDI", R_(edi));
- DECLARE("R_TRAPNO", R_(trapno));
- DECLARE("R_ERR", R_(err));
- DECLARE("R_EFLAGS", R_(efl));
- DECLARE("R_EIP", R_(eip));
- DECLARE("R_CR2", R_(cr2));
- DECLARE("ISS32_SIZE", sizeof (x86_saved_state32_t));
-
-#define R64_(x) offsetof(x86_saved_state_t *, ss_64.x)
- DECLARE("R64_FS", R64_(fs));
- DECLARE("R64_GS", R64_(gs));
- DECLARE("R64_R8", R64_(r8));
- DECLARE("R64_R9", R64_(r9));
- DECLARE("R64_R10", R64_(r10));
- DECLARE("R64_R11", R64_(r11));
- DECLARE("R64_R12", R64_(r12));
- DECLARE("R64_R13", R64_(r13));
- DECLARE("R64_R14", R64_(r14));
- DECLARE("R64_R15", R64_(r15));
- DECLARE("R64_RBP", R64_(rbp));
- DECLARE("R64_RAX", R64_(rax));
- DECLARE("R64_RBX", R64_(rbx));
- DECLARE("R64_RCX", R64_(rcx));
- DECLARE("R64_RDX", R64_(rdx));
- DECLARE("R64_RSI", R64_(rsi));
- DECLARE("R64_RDI", R64_(rdi));
- DECLARE("R64_V_ARG6", R64_(v_arg6));
- DECLARE("R64_V_ARG7", R64_(v_arg7));
- DECLARE("R64_V_ARG8", R64_(v_arg8));
- DECLARE("R64_CS", R64_(isf.cs));
- DECLARE("R64_SS", R64_(isf.ss));
- DECLARE("R64_RSP", R64_(isf.rsp));
- DECLARE("R64_TRAPNO", R64_(isf.trapno));
- DECLARE("R64_TRAPFN", R64_(isf.trapfn));
- DECLARE("R64_ERR", R64_(isf.err));
- DECLARE("R64_RFLAGS", R64_(isf.rflags));
- DECLARE("R64_RIP", R64_(isf.rip));
- DECLARE("R64_CR2", R64_(cr2));
- DECLARE("ISS64_OFFSET", R64_(isf));
- DECLARE("ISS64_SIZE", sizeof (x86_saved_state64_t));
-
-#define ISF64_(x) offsetof(x86_64_intr_stack_frame_t *, x)
- DECLARE("ISF64_TRAPNO", ISF64_(trapno));
- DECLARE("ISF64_TRAPFN", ISF64_(trapfn));
- DECLARE("ISF64_ERR", ISF64_(err));
- DECLARE("ISF64_RIP", ISF64_(rip));
- DECLARE("ISF64_CS", ISF64_(cs));
- DECLARE("ISF64_RFLAGS", ISF64_(rflags));
- DECLARE("ISF64_RSP", ISF64_(rsp));
- DECLARE("ISF64_SS", ISF64_(ss));
- DECLARE("ISF64_SIZE", sizeof(x86_64_intr_stack_frame_t));
-
- DECLARE("ISC32_OFFSET", offsetof(x86_saved_state_compat32_t *, isf64));
-#define ISC32_(x) offsetof(x86_saved_state_compat32_t *, isf64.x)
- DECLARE("ISC32_TRAPNO", ISC32_(trapno));
- DECLARE("ISC32_TRAPFN", ISC32_(trapfn));
- DECLARE("ISC32_ERR", ISC32_(err));
- DECLARE("ISC32_RIP", ISC32_(rip));
- DECLARE("ISC32_CS", ISC32_(cs));
- DECLARE("ISC32_RFLAGS", ISC32_(rflags));
- DECLARE("ISC32_RSP", ISC32_(rsp));
- DECLARE("ISC32_SS", ISC32_(ss));
-
- DECLARE("NBPG", I386_PGBYTES);
- DECLARE("PAGE_SIZE", I386_PGBYTES);
- DECLARE("PAGE_MASK", I386_PGBYTES-1);
- DECLARE("PAGE_SHIFT", 12);
- DECLARE("NKPT", NKPT);
- DECLARE("KPTDI", KPTDI);
- DECLARE("VM_MIN_ADDRESS", VM_MIN_ADDRESS);
- DECLARE("VM_MAX_ADDRESS", VM_MAX_ADDRESS);
- DECLARE("KERNELBASE", VM_MIN_KERNEL_ADDRESS);
- DECLARE("LINEAR_KERNELBASE", LINEAR_KERNEL_ADDRESS);
- DECLARE("KERNEL_STACK_SIZE", KERNEL_STACK_SIZE);
- DECLARE("KERNEL_UBER_BASE_HI32", KERNEL_UBER_BASE_HI32);
-
- DECLARE("COMM_PAGE_BASE_ADDR", _COMM_PAGE_BASE_ADDRESS);
-
- DECLARE("PDESHIFT", PDESHIFT);
- DECLARE("PTEMASK", PTEMASK);
- DECLARE("PTEINDX", PTEINDX);
- DECLARE("PTE_PFN", INTEL_PTE_PFN);
- DECLARE("PTE_V", INTEL_PTE_VALID);
- DECLARE("PTE_W", INTEL_PTE_WRITE);
- DECLARE("PTE_PS", INTEL_PTE_PS);
- DECLARE("PTE_U", INTEL_PTE_USER);
- DECLARE("PTE_INVALID", ~INTEL_PTE_VALID);
- DECLARE("NPGPTD", NPGPTD);
-
- DECLARE("IDTSZ", IDTSZ);
- DECLARE("GDTSZ", GDTSZ);
- DECLARE("LDTSZ", LDTSZ);
-
- DECLARE("KERNEL_CS", KERNEL_CS);
- DECLARE("KERNEL_DS", KERNEL_DS);
- DECLARE("USER_CS", USER_CS);
- DECLARE("USER_DS", USER_DS);
- DECLARE("KERNEL64_CS", KERNEL64_CS);
- DECLARE("USER64_CS", USER64_CS);
- DECLARE("KERNEL_TSS", KERNEL_TSS);
- DECLARE("KERNEL_LDT", KERNEL_LDT);
- DECLARE("DF_TSS", DF_TSS);
- DECLARE("MC_TSS", MC_TSS);
-#if MACH_KDB
- DECLARE("DEBUG_TSS", DEBUG_TSS);
-#endif /* MACH_KDB */
- DECLARE("CPU_DATA_GS", CPU_DATA_GS);
- DECLARE("SYSENTER_CS", SYSENTER_CS);
- DECLARE("SYSENTER_TF_CS",SYSENTER_TF_CS);
- DECLARE("SYSENTER_DS", SYSENTER_DS);
- DECLARE("SYSCALL_CS", SYSCALL_CS);
- DECLARE("USER_WINDOW_SEL", USER_WINDOW_SEL);
- DECLARE("PHYS_WINDOW_SEL", PHYS_WINDOW_SEL);
-
- DECLARE("CPU_THIS",
- offsetof(cpu_data_t *, cpu_this));
- DECLARE("CPU_ACTIVE_THREAD",
- offsetof(cpu_data_t *, cpu_active_thread));
- DECLARE("CPU_ACTIVE_STACK",
- offsetof(cpu_data_t *, cpu_active_stack));
- DECLARE("CPU_KERNEL_STACK",
- offsetof(cpu_data_t *, cpu_kernel_stack));
- DECLARE("CPU_INT_STACK_TOP",
- offsetof(cpu_data_t *, cpu_int_stack_top));
-#if MACH_RT
- DECLARE("CPU_PREEMPTION_LEVEL",
- offsetof(cpu_data_t *, cpu_preemption_level));
-#endif /* MACH_RT */
- DECLARE("CPU_INTERRUPT_LEVEL",
- offsetof(cpu_data_t *, cpu_interrupt_level));
- DECLARE("CPU_SIMPLE_LOCK_COUNT",
- offsetof(cpu_data_t *,cpu_simple_lock_count));
- DECLARE("CPU_NUMBER_GS",
- offsetof(cpu_data_t *,cpu_number));
- DECLARE("CPU_RUNNING",
- offsetof(cpu_data_t *,cpu_running));
- DECLARE("CPU_MCOUNT_OFF",
- offsetof(cpu_data_t *,cpu_mcount_off));
+ DECLARE("TH_TASK", offsetof(struct thread, task));
+ DECLARE("TH_AST", offsetof(struct thread, ast));
+ DECLARE("TH_MAP", offsetof(struct thread, map));
+ DECLARE("TH_SPF", offsetof(struct thread, machine.specFlags));
+ DECLARE("TH_PCB_ISS", offsetof(struct thread, machine.iss));
+ DECLARE("TH_PCB_IDS", offsetof(struct thread, machine.ids));
+ DECLARE("TH_PCB_FPS", offsetof(struct thread, machine.ifps));
+ DECLARE("TH_RWLOCK_COUNT", offsetof(struct thread, rwlock_count));
+ DECLARE("TH_TMP_ALLOC_CNT", offsetof(struct thread, t_temp_alloc_count));
+
+ DECLARE("MAP_PMAP", offsetof(struct _vm_map, pmap));
+
+#define IEL_SIZE (sizeof(struct i386_exception_link *))
+ DECLARE("IKS_SIZE", sizeof(struct thread_kernel_state));
+
+ /*
+ * KSS_* are offsets from the top of the kernel stack (cpu_kernel_stack)
+ */
+ DECLARE("KSS_RBX", offsetof(struct thread_kernel_state, machine.k_rbx));
+ DECLARE("KSS_RSP", offsetof(struct thread_kernel_state, machine.k_rsp));
+ DECLARE("KSS_RBP", offsetof(struct thread_kernel_state, machine.k_rbp));
+ DECLARE("KSS_R12", offsetof(struct thread_kernel_state, machine.k_r12));
+ DECLARE("KSS_R13", offsetof(struct thread_kernel_state, machine.k_r13));
+ DECLARE("KSS_R14", offsetof(struct thread_kernel_state, machine.k_r14));
+ DECLARE("KSS_R15", offsetof(struct thread_kernel_state, machine.k_r15));
+ DECLARE("KSS_RIP", offsetof(struct thread_kernel_state, machine.k_rip));
+
+ DECLARE("DS_DR0", offsetof(struct x86_debug_state32, dr0));
+ DECLARE("DS_DR1", offsetof(struct x86_debug_state32, dr1));
+ DECLARE("DS_DR2", offsetof(struct x86_debug_state32, dr2));
+ DECLARE("DS_DR3", offsetof(struct x86_debug_state32, dr3));
+ DECLARE("DS_DR4", offsetof(struct x86_debug_state32, dr4));
+ DECLARE("DS_DR5", offsetof(struct x86_debug_state32, dr5));
+ DECLARE("DS_DR6", offsetof(struct x86_debug_state32, dr6));
+ DECLARE("DS_DR7", offsetof(struct x86_debug_state32, dr7));
+
+ DECLARE("DS64_DR0", offsetof(struct x86_debug_state64, dr0));
+ DECLARE("DS64_DR1", offsetof(struct x86_debug_state64, dr1));
+ DECLARE("DS64_DR2", offsetof(struct x86_debug_state64, dr2));
+ DECLARE("DS64_DR3", offsetof(struct x86_debug_state64, dr3));
+ DECLARE("DS64_DR4", offsetof(struct x86_debug_state64, dr4));
+ DECLARE("DS64_DR5", offsetof(struct x86_debug_state64, dr5));
+ DECLARE("DS64_DR6", offsetof(struct x86_debug_state64, dr6));
+ DECLARE("DS64_DR7", offsetof(struct x86_debug_state64, dr7));
+
+ DECLARE("FP_VALID", offsetof(struct x86_fx_thread_state, fp_valid));
+
+ DECLARE("SS_FLAVOR", offsetof(x86_saved_state_t, flavor));
+ DECLARE("SS_32", x86_SAVED_STATE32);
+ DECLARE("SS_64", x86_SAVED_STATE64);
+
+#define R_(x) offsetof(x86_saved_state_t, ss_32.x)
+ DECLARE("R32_CS", R_(cs));
+ DECLARE("R32_SS", R_(ss));
+ DECLARE("R32_DS", R_(ds));
+ DECLARE("R32_ES", R_(es));
+ DECLARE("R32_FS", R_(fs));
+ DECLARE("R32_GS", R_(gs));
+ DECLARE("R32_UESP", R_(uesp));
+ DECLARE("R32_EBP", R_(ebp));
+ DECLARE("R32_EAX", R_(eax));
+ DECLARE("R32_EBX", R_(ebx));
+ DECLARE("R32_ECX", R_(ecx));
+ DECLARE("R32_EDX", R_(edx));
+ DECLARE("R32_ESI", R_(esi));
+ DECLARE("R32_EDI", R_(edi));
+ DECLARE("R32_TRAPNO", R_(trapno));
+ DECLARE("R32_ERR", R_(err));
+ DECLARE("R32_EFLAGS", R_(efl));
+ DECLARE("R32_EIP", R_(eip));
+ DECLARE("R32_CR2", R_(cr2));
+ DECLARE("ISS32_SIZE", sizeof(x86_saved_state32_t));
+
+#define R64_(x) offsetof(x86_saved_state_t, ss_64.x)
+ DECLARE("R64_DS", R64_(ds));
+ DECLARE("R64_ES", R64_(es));
+ DECLARE("R64_FS", R64_(fs));
+ DECLARE("R64_GS", R64_(gs));
+ DECLARE("R64_R8", R64_(r8));
+ DECLARE("R64_R9", R64_(r9));
+ DECLARE("R64_R10", R64_(r10));
+ DECLARE("R64_R11", R64_(r11));
+ DECLARE("R64_R12", R64_(r12));
+ DECLARE("R64_R13", R64_(r13));
+ DECLARE("R64_R14", R64_(r14));
+ DECLARE("R64_R15", R64_(r15));
+ DECLARE("R64_RBP", R64_(rbp));
+ DECLARE("R64_RAX", R64_(rax));
+ DECLARE("R64_RBX", R64_(rbx));
+ DECLARE("R64_RCX", R64_(rcx));
+ DECLARE("R64_RDX", R64_(rdx));
+ DECLARE("R64_RSI", R64_(rsi));
+ DECLARE("R64_RDI", R64_(rdi));
+ DECLARE("R64_CS", R64_(isf.cs));
+ DECLARE("R64_SS", R64_(isf.ss));
+ DECLARE("R64_RSP", R64_(isf.rsp));
+ DECLARE("R64_TRAPNO", R64_(isf.trapno));
+ DECLARE("R64_TRAPFN", R64_(isf.trapfn));
+ DECLARE("R64_ERR", R64_(isf.err));
+ DECLARE("R64_RFLAGS", R64_(isf.rflags));
+ DECLARE("R64_RIP", R64_(isf.rip));
+ DECLARE("R64_CR2", R64_(cr2));
+ DECLARE("ISS64_OFFSET", R64_(isf));
+ DECLARE("ISS64_SIZE", sizeof(x86_saved_state64_t));
+
+#define ISF64_(x) offsetof(x86_64_intr_stack_frame_t, x)
+ DECLARE("ISF64_TRAPNO", ISF64_(trapno));
+ DECLARE("ISF64_TRAPFN", ISF64_(trapfn));
+ DECLARE("ISF64_ERR", ISF64_(err));
+ DECLARE("ISF64_RIP", ISF64_(rip));
+ DECLARE("ISF64_CS", ISF64_(cs));
+ DECLARE("ISF64_RFLAGS", ISF64_(rflags));
+ DECLARE("ISF64_RSP", ISF64_(rsp));
+ DECLARE("ISF64_SS", ISF64_(ss));
+ DECLARE("ISF64_SIZE", sizeof(x86_64_intr_stack_frame_t));
+
+ DECLARE("NBPG", I386_PGBYTES);
+ DECLARE("PAGE_SIZE", I386_PGBYTES);
+ DECLARE("PAGE_MASK", I386_PGBYTES - 1);
+ DECLARE("PAGE_SHIFT", 12);
+ DECLARE("NKPT", NKPT);
+ DECLARE("VM_MIN_ADDRESS", VM_MIN_ADDRESS);
+ DECLARE("VM_MAX_ADDRESS", VM_MAX_ADDRESS);
+ DECLARE("KERNELBASE", VM_MIN_KERNEL_ADDRESS);
+ DECLARE("LINEAR_KERNELBASE", LINEAR_KERNEL_ADDRESS);
+ DECLARE("KERNEL_STACK_SIZE", KERNEL_STACK_SIZE);
+
+ DECLARE("ASM_COMM_PAGE32_BASE_ADDRESS", _COMM_PAGE32_BASE_ADDRESS);
+ DECLARE("ASM_COMM_PAGE32_START_ADDRESS", _COMM_PAGE32_START_ADDRESS);
+
+ DECLARE("KERNEL_PML4_INDEX", KERNEL_PML4_INDEX);
+ DECLAREULL("KERNEL_BASE", KERNEL_BASE);
+ DECLARE("IDTSZ", IDTSZ);
+ DECLARE("GDTSZ", GDTSZ);
+
+ DECLARE("KERNEL_DS", KERNEL_DS);
+ DECLARE("USER_CS", USER_CS);
+ DECLARE("USER_DS", USER_DS);
+ DECLARE("USER_CTHREAD", USER_CTHREAD);
+ DECLARE("KERNEL32_CS", KERNEL32_CS);
+ DECLARE("KERNEL64_CS", KERNEL64_CS);
+ DECLARE("USER64_CS", USER64_CS);
+ DECLARE("KERNEL_TSS", KERNEL_TSS);
+ DECLARE("KERNEL_LDT", KERNEL_LDT);
+ DECLARE("SYSENTER_CS", SYSENTER_CS);
+ DECLARE("SYSENTER_TF_CS", SYSENTER_TF_CS);
+ DECLARE("SYSENTER_DS", SYSENTER_DS);
+ DECLARE("SYSCALL_CS", SYSCALL_CS);
+
+ DECLARE("CPU_THIS",
+ offsetof(cpu_data_t, cpu_this));
+ DECLARE("CPU_ACTIVE_THREAD",
+ offsetof(cpu_data_t, cpu_active_thread));
+ DECLARE("CPU_ACTIVE_STACK",
+ offsetof(cpu_data_t, cpu_active_stack));
+ DECLARE("CPU_KERNEL_STACK",
+ offsetof(cpu_data_t, cpu_kernel_stack));
+ DECLARE("CPU_INT_STACK_TOP",
+ offsetof(cpu_data_t, cpu_int_stack_top));
+ DECLARE("CPU_PREEMPTION_LEVEL",
+ offsetof(cpu_data_t, cpu_preemption_level));
+ DECLARE("CPU_HIBERNATE",
+ offsetof(cpu_data_t, cpu_hibernate));
+ DECLARE("CPU_INTERRUPT_LEVEL",
+ offsetof(cpu_data_t, cpu_interrupt_level));
+ DECLARE("CPU_NEED_SEGCHK",
+ offsetof(cpu_data_t, cpu_curthread_do_segchk));
+ DECLARE("CPU_NESTED_ISTACK",
+ offsetof(cpu_data_t, cpu_nested_istack));
+ DECLARE("CPU_NUMBER_GS",
+ offsetof(cpu_data_t, cpu_number));
+ DECLARE("CPU_RUNNING",
+ offsetof(cpu_data_t, cpu_running));