i386: Move base_memory from mp_machdep.c to machdep.c
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Thu, 2 Jun 2011 12:10:41 +0000 (20:10 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Sat, 4 Jun 2011 11:47:59 +0000 (19:47 +0800)
sys/platform/pc32/i386/machdep.c
sys/platform/pc32/i386/mp_machdep.c

index 3a5a3c8..e4c9596 100644 (file)
@@ -169,6 +169,8 @@ int imcr_present = 0;
 
 int naps = 0; /* # of Applications processors */
 
+u_int base_memory;
+
 static int
 sysctl_hw_physmem(SYSCTL_HANDLER_ARGS)
 {
@@ -1673,9 +1675,10 @@ physmap_done:
         * Now, physmap contains a map of physical memory.
         */
 
+       base_memory = physmap[1];
 #ifdef SMP
        /* make hole for AP bootstrap code YYY */
-       physmap[1] = mp_bootaddress(physmap[1]);
+       physmap[1] = mp_bootaddress(base_memory);
 #endif
 
        /* Save EBDA address, if any */
index 2f29621..6bbf698 100644 (file)
@@ -181,8 +181,6 @@ static cpumask_t smp_lapic_mask = 1;        /* which cpus have lapic been inited */
 cpumask_t smp_active_mask = 1; /* which cpus are ready for IPIs etc? */
 SYSCTL_INT(_machdep, OID_AUTO, smp_active, CTLFLAG_RD, &smp_active_mask, 0, "");
 
-u_int                  base_memory;
-
 /*
  * Calculate usable address in base memory for AP trampoline code.
  */
@@ -191,10 +189,8 @@ mp_bootaddress(u_int basemem)
 {
        POSTCODE(MP_BOOTADDRESS_POST);
 
-       base_memory = basemem;
-
-       boot_address = base_memory & ~0xfff;    /* round down to 4k boundary */
-       if ((base_memory - boot_address) < bootMP_size)
+       boot_address = basemem & ~0xfff;        /* round down to 4k boundary */
+       if ((basemem - boot_address) < bootMP_size)
                boot_address -= 4096;   /* not enough, lower by 4k */
 
        return boot_address;