Clear unused parts of f-segment.
authorKevin O'Connor <kevin@koconnor.net>
Wed, 25 Nov 2009 23:53:52 +0000 (18:53 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Wed, 25 Nov 2009 23:53:52 +0000 (18:53 -0500)
On coreboot, the unused parts of the f-segment could contain leftover
    bios tables which may confuse an OS.  So clear unused parts of
    f-segment.

src/pmm.c

index d8f493721c1bbc7cfb04c49a64714a12cd8c46b4..48a882a394e9e49031d6331577bbecd9941dac72 100644 (file)
--- a/src/pmm.c
+++ b/src/pmm.c
@@ -285,6 +285,10 @@ malloc_setup()
     PMMAllocs = NULL;
 
     // Memory in 0xf0000 area.
+    extern u8 code32_start[];
+    if ((u32)code32_start > BUILD_BIOS_ADDR)
+        // Clear unused parts of f-segment
+        memset((void*)BUILD_BIOS_ADDR, 0, (u32)code32_start - BUILD_BIOS_ADDR);
     memset(BiosTableSpace, 0, CONFIG_MAX_BIOSTABLE);
     ZoneFSeg.bottom = (u32)BiosTableSpace;
     ZoneFSeg.top = ZoneFSeg.cur = ZoneFSeg.bottom + CONFIG_MAX_BIOSTABLE;