Don't reset .bss on reboots.
Since .data isn't reset on a reboot, it's confusing to reset .bss.
Fixup all places that assumed .bss variables were reset.
diff --git a/src/memmap.c b/src/memmap.c
index f74f4f2..16c57ac 100644
--- a/src/memmap.c
+++ b/src/memmap.c
@@ -142,6 +142,7 @@
dprintf(1, "No room for e820 map!\n");
return;
}
+ e820_count = 0;
e820_list = (void*)bios_table_cur_addr;
bios_table_cur_addr += msize;
}
diff --git a/src/post.c b/src/post.c
index 03049ee..68a473c 100644
--- a/src/post.c
+++ b/src/post.c
@@ -196,6 +196,7 @@
mathcp_setup();
pci_bus_setup();
+ smp_probe_setup();
memmap_setup();
ram_probe();
@@ -219,15 +220,6 @@
optionrom_setup();
}
-// Clear .bss section for C code.
-static void
-clear_bss()
-{
- dprintf(3, "clearing .bss section\n");
- extern char __bss_start[], __bss_end[];
- memset(__bss_start, 0, __bss_end - __bss_start);
-}
-
// Reset DMA controller
static void
init_dma()
@@ -278,9 +270,8 @@
debug_serial_setup();
dprintf(1, "Start bios\n");
- // Setup for .bss and .data sections
+ // Allow writes to modify bios area (0xf0000)
make_bios_writable();
- clear_bss();
// Perform main setup code.
post();
diff --git a/src/smpdetect.c b/src/smpdetect.c
index eda0ecf..56069df 100644
--- a/src/smpdetect.c
+++ b/src/smpdetect.c
@@ -105,3 +105,10 @@
return smp_cpus;
}
+
+// Reset smp_cpus to zero (forces a recheck on reboots).
+void
+smp_probe_setup(void)
+{
+ smp_cpus = 0;
+}
diff --git a/src/util.h b/src/util.h
index dadc517..b356c4e 100644
--- a/src/util.h
+++ b/src/util.h
@@ -148,6 +148,7 @@
// smpdetect.c
int smp_probe(void);
+void smp_probe_setup(void);
// mptable.c
void mptable_init(void);