]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/i386/genassym.c
xnu-4570.41.2.tar.gz
[apple/xnu.git] / osfmk / i386 / genassym.c
index 287aa8bd05e4588b5382812c4af0bf62cb4d6cf2..f6812c6f0cca2877d62f230d53d351193a34ccb9 100644 (file)
@@ -54,6 +54,8 @@
  * the rights to redistribute these changes.
  */
 
+#include <stddef.h>
+
 #include <mach_ldebug.h>
 
 /*
@@ -84,9 +86,6 @@
 #include <machine/commpage.h>
 #include <pexpert/i386/boot.h>
 
-#undef offsetof
-#include <stddef.h>
-
 #if    CONFIG_DTRACE
 #define NEED_DTRACE_DEFS
 #include <../bsd/sys/lockstat.h>
  */
 
 #define DECLARE(SYM,VAL) \
-       __asm("#DEFINITION##define " SYM "\t%0" : : "n" ((u_int)(VAL)))
+       __asm("DEFINITION__define__" SYM ":\t .ascii \"%0\"" : : "n"  ((u_int)(VAL)))
 
 int    main(
                int             argc,
@@ -139,7 +138,6 @@ main(
        DECLARE("MUTEX_PTR",   offsetof(lck_mtx_t, lck_mtx_ptr));
        DECLARE("MUTEX_STATE", offsetof(lck_mtx_t, lck_mtx_state));
        DECLARE("MUTEX_IND",    LCK_MTX_TAG_INDIRECT);
-       DECLARE("MUTEX_PTR",    offsetof(lck_mtx_t, lck_mtx_ptr));
        DECLARE("MUTEX_ASSERT_OWNED",   LCK_MTX_ASSERT_OWNED);
        DECLARE("MUTEX_ASSERT_NOTOWNED",LCK_MTX_ASSERT_NOTOWNED);
        DECLARE("GRP_MTX_STAT_UTIL",    offsetof(lck_grp_t, lck_grp_stat.lck_grp_mtx_stat.lck_grp_mtx_util_cnt));
@@ -194,19 +192,19 @@ main(
        DECLARE("MAP_PMAP",     offsetof(struct _vm_map, pmap));
 
 #define IEL_SIZE               (sizeof(struct i386_exception_link *))
-       DECLARE("IKS_SIZE",     sizeof(struct x86_kernel_state));
+       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 x86_kernel_state, k_rbx));
-       DECLARE("KSS_RSP",      offsetof(struct x86_kernel_state, k_rsp));
-       DECLARE("KSS_RBP",      offsetof(struct x86_kernel_state, k_rbp));
-       DECLARE("KSS_R12",      offsetof(struct x86_kernel_state, k_r12));
-       DECLARE("KSS_R13",      offsetof(struct x86_kernel_state, k_r13));
-       DECLARE("KSS_R14",      offsetof(struct x86_kernel_state, k_r14));
-       DECLARE("KSS_R15",      offsetof(struct x86_kernel_state, k_r15));
-       DECLARE("KSS_RIP",      offsetof(struct x86_kernel_state, k_rip));      
+       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));
@@ -310,24 +308,14 @@ main(
        DECLARE("ASM_COMM_PAGE32_START_ADDRESS",  _COMM_PAGE32_START_ADDRESS);
        DECLARE("ASM_COMM_PAGE_SCHED_GEN",  _COMM_PAGE_SCHED_GEN);
 
-       DECLARE("PDESHIFT",     PDESHIFT);
-       DECLARE("PTEMASK",      PTEMASK);
-       DECLARE("PTEINDX",      PTEINDX);
-       DECLARE("INTEL_PTE_PFN",        INTEL_PTE_PFN);
-       DECLARE("INTEL_PTE_VALID",      INTEL_PTE_VALID);
-       DECLARE("INTEL_PTE_WRITE",      INTEL_PTE_WRITE);
-       DECLARE("INTEL_PTE_PS",       INTEL_PTE_PS);
-       DECLARE("INTEL_PTE_USER",        INTEL_PTE_USER);
-       DECLARE("INTEL_PTE_INVALID",    INTEL_PTE_INVALID);
-       DECLARE("NPGPTD", NPGPTD);
-       DECLARE("KERNEL_PML4_INDEX",KERNEL_PML4_INDEX);
+       DECLARE("KERNEL_PML4_INDEX", KERNEL_PML4_INDEX);
        DECLARE("IDTSZ",        IDTSZ);
        DECLARE("GDTSZ",        GDTSZ);
-       DECLARE("LDTSZ",        LDTSZ);
 
        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);
@@ -348,10 +336,8 @@ main(
                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_HIBERNATE",
                offsetof(cpu_data_t, cpu_hibernate));
         DECLARE("CPU_INTERRUPT_LEVEL",
@@ -364,14 +350,6 @@ main(
                offsetof(cpu_data_t,cpu_running));
        DECLARE("CPU_PENDING_AST",
                offsetof(cpu_data_t,cpu_pending_ast));
-       DECLARE("CPU_DESC_TABLEP",
-               offsetof(cpu_data_t,cpu_desc_tablep));
-       DECLARE("CPU_DESC_INDEX",
-               offsetof(cpu_data_t,cpu_desc_index));
-       DECLARE("CDI_GDT",
-               offsetof(cpu_desc_index_t,cdi_gdt));
-       DECLARE("CDI_IDT",
-               offsetof(cpu_desc_index_t,cdi_idt));
        DECLARE("CPU_PROCESSOR",
                offsetof(cpu_data_t,cpu_processor));
         DECLARE("CPU_INT_STATE",
@@ -385,8 +363,18 @@ main(
                offsetof(cpu_data_t, cpu_active_cr3));
         DECLARE("CPU_KERNEL_CR3",
                offsetof(cpu_data_t, cpu_kernel_cr3));
+       DECLARE("CPU_UCR3",
+               offsetof(cpu_data_t, cpu_ucr3));
+#if    DEBUG
+       DECLARE("CPU_ENTRY_CR3",
+               offsetof(cpu_data_t, cpu_entry_cr3));
+       DECLARE("CPU_EXIT_CR3",
+               offsetof(cpu_data_t, cpu_exit_cr3));
+#endif
        DECLARE("CPU_TLB_INVALID",
                offsetof(cpu_data_t, cpu_tlb_invalid));
+       DECLARE("CPU_PAGEZERO_MAPPED",
+               offsetof(cpu_data_t, cpu_pagezero_mapped));
 
        DECLARE("CPU_TASK_MAP",
                offsetof(cpu_data_t, cpu_task_map));
@@ -408,6 +396,9 @@ main(
        DECLARE("hwIntCnt",     offsetof(cpu_data_t,cpu_hwIntCnt));
        DECLARE("CPU_ACTIVE_PCID",
                offsetof(cpu_data_t, cpu_active_pcid));
+       DECLARE("CPU_KERNEL_PCID",
+               offsetof(cpu_data_t, cpu_kernel_pcid));
+
        DECLARE("CPU_PCID_COHERENTP",
                offsetof(cpu_data_t, cpu_pmap_pcid_coherentp));
        DECLARE("CPU_PCID_COHERENTP_KERNEL",
@@ -423,12 +414,15 @@ main(
        DECLARE("CPU_PMAP_PCID_FLUSHES",
            offsetof(cpu_data_t, cpu_pmap_pcid_flushes));
 #endif
-       DECLARE("CPU_TLB_INVALID",
-               offsetof(cpu_data_t, cpu_tlb_invalid));
        DECLARE("CPU_TLB_INVALID_LOCAL",
            offsetof(cpu_data_t, cpu_tlb_invalid_local));
        DECLARE("CPU_TLB_INVALID_GLOBAL",
                offsetof(cpu_data_t, cpu_tlb_invalid_global));
+       DECLARE("CPU_ESTACK",
+               offsetof(cpu_data_t, cd_estack));
+       DECLARE("CPU_DSHADOW",
+               offsetof(cpu_data_t, cd_shadow));
+
        DECLARE("enaExpTrace",  enaExpTrace);
        DECLARE("enaUsrFCall",  enaUsrFCall);
        DECLARE("enaUsrPhyMp",  enaUsrPhyMp);
@@ -443,15 +437,6 @@ main(
        DECLARE("dgMisc4",              offsetof(struct diagWork, dgMisc4));
        DECLARE("dgMisc5",              offsetof(struct diagWork, dgMisc5));
 
-       DECLARE("INTEL_PTE_KERNEL",     INTEL_PTE_VALID|INTEL_PTE_WRITE);
-       DECLARE("PDESHIFT",     PDESHIFT);
-       DECLARE("PDESIZE",     PDESIZE);
-       DECLARE("PTESIZE",     PTESIZE);
-
-       DECLARE("KERNELBASEPDE",
-               (LINEAR_KERNEL_ADDRESS >> PDESHIFT) *
-               sizeof(pt_entry_t));
-
        DECLARE("TSS_ESP0",     offsetof(struct i386_tss, esp0));
        DECLARE("TSS_SS0",      offsetof(struct i386_tss, ss0));
        DECLARE("TSS_LDT",      offsetof(struct i386_tss, ldt));