]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/i386/lapic_native.c
xnu-4903.241.1.tar.gz
[apple/xnu.git] / osfmk / i386 / lapic_native.c
index e9983aa79dc35ba2e2305d40e80bd52f01923ece..73e5e1c13d8c83113fb43954e61487260bb182d6 100644 (file)
 #include <i386/machine_check.h>
 #endif
 
 #include <i386/machine_check.h>
 #endif
 
-#if CONFIG_COUNTERS
-#include <pmc/pmc.h>
-#endif
-
 #include <sys/kdebug.h>
 
 #if    MP_DEBUG
 #include <sys/kdebug.h>
 
 #if    MP_DEBUG
@@ -112,6 +108,7 @@ static void
 legacy_init(void)
 {
        int             result;
 legacy_init(void)
 {
        int             result;
+       kern_return_t   kr;
        vm_map_entry_t  entry;
        vm_map_offset_t lapic_vbase64;
        /* Establish a map to the local apic */
        vm_map_entry_t  entry;
        vm_map_offset_t lapic_vbase64;
        /* Establish a map to the local apic */
@@ -121,7 +118,10 @@ legacy_init(void)
                result = vm_map_find_space(kernel_map,
                                           &lapic_vbase64,
                                           round_page(LAPIC_SIZE), 0,
                result = vm_map_find_space(kernel_map,
                                           &lapic_vbase64,
                                           round_page(LAPIC_SIZE), 0,
-                                          VM_MAKE_TAG(VM_MEMORY_IOKIT), &entry);
+                                          0,
+                                          VM_MAP_KERNEL_FLAGS_NONE,
+                                          VM_KERN_MEMORY_IOKIT,
+                                          &entry);
                /* Convert 64-bit vm_map_offset_t to "pointer sized" vm_offset_t
                 */
                lapic_vbase = (vm_offset_t) lapic_vbase64;
                /* Convert 64-bit vm_map_offset_t to "pointer sized" vm_offset_t
                 */
                lapic_vbase = (vm_offset_t) lapic_vbase64;
@@ -137,13 +137,15 @@ legacy_init(void)
                 * MTRR physical range containing the local APIC's MMIO space as
                 * UC and this will override the default PAT setting.
                 */
                 * MTRR physical range containing the local APIC's MMIO space as
                 * UC and this will override the default PAT setting.
                 */
-               pmap_enter(pmap_kernel(),
-                               lapic_vbase,
-                               (ppnum_t) i386_btop(lapic_pbase),
-                               VM_PROT_READ|VM_PROT_WRITE,
-                               VM_PROT_NONE,
-                               VM_WIMG_IO,
-                               TRUE);
+               kr = pmap_enter(pmap_kernel(),
+                               lapic_vbase,
+                               (ppnum_t) i386_btop(lapic_pbase),
+                               VM_PROT_READ|VM_PROT_WRITE,
+                               VM_PROT_NONE,
+                               VM_WIMG_IO,
+                               TRUE);
+
+               assert(kr == KERN_SUCCESS);
        }
 
        /*
        }
 
        /*
@@ -800,17 +802,12 @@ lapic_interrupt(int interrupt_num, x86_saved_state_t *state)
                break;
        case LAPIC_PMC_SW_INTERRUPT: 
                {
                break;
        case LAPIC_PMC_SW_INTERRUPT: 
                {
-#if CONFIG_COUNTERS
-                       thread_t old, new;
-                       ml_get_csw_threads(&old, &new);
-
-                       if (pmc_context_switch(old, new) == TRUE) {
-                               retval = 1;
-                               /* No EOI required for SWI */
-                       }
-#endif /* CONFIG_COUNTERS */
                }
                break;
                }
                break;
+       case LAPIC_KICK_INTERRUPT:
+               _lapic_end_of_interrupt();
+               retval = 1;
+               break;
        }
 
        return retval;
        }
 
        return retval;
@@ -967,13 +964,13 @@ lapic_get_cmci_vector(void)
        return cmci_vector;
 }
 
        return cmci_vector;
 }
 
-#if DEBUG
+#if DEVELOPMENT || DEBUG
 extern void lapic_trigger_MC(void);
 void
 lapic_trigger_MC(void)
 {
        /* A 64-bit access to any register will do it. */
 extern void lapic_trigger_MC(void);
 void
 lapic_trigger_MC(void)
 {
        /* A 64-bit access to any register will do it. */
-       volatile uint64_t dummy = *(uint64_t *) (void *) LAPIC_MMIO(ID);
+       volatile uint64_t dummy = *(volatile uint64_t *) (volatile void *) LAPIC_MMIO(ID);
        dummy++;
 }
 #endif
        dummy++;
 }
 #endif