Defer LAPIC mapping from pmap_bootstrap() to mp_enable()
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Tue, 9 Jun 2009 11:47:58 +0000 (19:47 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Tue, 9 Jun 2009 14:01:49 +0000 (22:01 +0800)
Discussed-with: dillon@

sys/platform/pc32/i386/mp_machdep.c
sys/platform/pc32/i386/pmap.c
sys/platform/pc32/include/pmap.h

index fc16a60..5f1b3bf 100644 (file)
@@ -511,6 +511,13 @@ mp_enable(u_int boot_addr)
 
        POSTCODE(MP_ENABLE_POST);
 
+       if (cpu_apic_address == 0)
+               panic("pmap_bootstrap: no local apic!");
+
+       /* local apic is mapped on last page */
+       SMPpt[NPTEPG - 1] = (pt_entry_t)(PG_V | PG_RW | PG_N |
+           pmap_get_pgeflag() | (cpu_apic_address & PG_FRAME));
+
        /* turn on 4MB of V == P addressing so we can get to MP table */
        *(int *)PTD = PG_V | PG_RW | ((uintptr_t)(void *)KPTphys & PG_FRAME);
        cpu_invltlb();
index 11d8f3b..0504439 100644 (file)
@@ -445,14 +445,6 @@ pmap_bootstrap(vm_paddr_t firstaddr, vm_paddr_t loadaddr)
 #endif
        }
 #endif
-#ifdef SMP
-       if (cpu_apic_address == 0)
-               panic("pmap_bootstrap: no local apic!");
-
-       /* local apic is mapped on last page */
-       SMPpt[NPTEPG - 1] = (pt_entry_t)(PG_V | PG_RW | PG_N | pgeflag |
-           (cpu_apic_address & PG_FRAME));
-#endif
 
        /*
         * We need to finish setting up the globaldata page for the BSP.
@@ -3351,6 +3343,11 @@ pmap_addr_hint(vm_object_t obj, vm_offset_t addr, vm_size_t size)
        return addr;
 }
 
+int
+pmap_get_pgeflag(void)
+{
+       return pgeflag;
+}
 
 #if defined(DEBUG)
 
index 52870a5..9d7dda8 100644 (file)
@@ -245,6 +245,7 @@ void        *pmap_mapdev (vm_paddr_t, vm_size_t);
 void   pmap_unmapdev (vm_offset_t, vm_size_t);
 unsigned *pmap_pte (pmap_t, vm_offset_t) __pure2;
 struct vm_page *pmap_use_pt (pmap_t, vm_offset_t);
+int    pmap_get_pgeflag(void);
 #ifdef SMP
 void   pmap_set_opt (void);
 #endif