x86_64: Make APIC_IO work again.
authorMichael Neumann <mneumann@ntecs.de>
Sat, 16 Oct 2010 10:14:26 +0000 (12:14 +0200)
committerMichael Neumann <mneumann@ntecs.de>
Sat, 16 Oct 2010 10:14:26 +0000 (12:14 +0200)
pmap_init() still needs to setup the lapic pointer otherwise
it results in a null pointer deref somewhere else.

sys/platform/pc64/apic/mpapic.c
sys/platform/pc64/x86_64/pmap.c

index 884f2e1..da927e0 100644 (file)
@@ -999,6 +999,11 @@ u_sleep(int count)
                 /* spin */ ;
 }
 
+/*
+ * XXX: Hack: Used by pmap_init
+ */
+vm_offset_t cpu_apic_addr;
+
 void
 lapic_init(vm_offset_t lapic_addr)
 {
@@ -1013,6 +1018,8 @@ lapic_init(vm_offset_t lapic_addr)
            pmap_get_pgeflag() | (lapic_addr & PG_FRAME));
 #endif
 
+       cpu_apic_addr = lapic_addr;
+
        kprintf("lapic: at 0x%08lx\n", lapic_addr);
 }
 
index 4280352..7b0d2bb 100644 (file)
@@ -738,6 +738,11 @@ pmap_set_opt(void)
 #endif
 
 /*
+ * XXX: Hack. Required by pmap_init()
+ */
+extern vm_offset_t cpu_apic_addr;
+
+/*
  *     Initialize the pmap module.
  *     Called by vm_init, to initialize any structures that the pmap
  *     system needs to map virtual memory.
@@ -785,6 +790,12 @@ pmap_init(void)
         * Now it is safe to enable pv_table recording.
         */
        pmap_initialized = TRUE;
+#ifdef SMP
+       /*
+        * XXX: Hack 
+        */
+       lapic = pmap_mapdev_uncacheable(cpu_apic_addr, sizeof(struct LAPIC));
+#endif
 }
 
 /*