summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarty Connor2008-12-18 05:28:27 +0100
committerMichael Brown2008-12-18 18:28:57 +0100
commit8674bc05a054fe8c0ef5ed4e6696d0f1168af74c (patch)
treea5680ea7be790496ddbf66c4de22f58ca198e7f3
parent[etherfabric] Make use of pci_bar_start() 64-bit clean (diff)
downloadipxe-8674bc05a054fe8c0ef5ed4e6696d0f1168af74c.tar.gz
ipxe-8674bc05a054fe8c0ef5ed4e6696d0f1168af74c.tar.xz
ipxe-8674bc05a054fe8c0ef5ed4e6696d0f1168af74c.zip
[pcbios] Add additional sanity check for bogus e820 map
At POST time some BIOSes return invalid e820 maps even though they indicate that the data is valid. We add a check that the first region returned by e820 is RAM type and declare the map to be invalid if it is not. This extends the sanity checks from 8b20e5d ("[pcbios] Sanity-check the INT15,e820 and INT15,e801 memory maps").
-rw-r--r--src/arch/i386/firmware/pcbios/memmap.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/arch/i386/firmware/pcbios/memmap.c b/src/arch/i386/firmware/pcbios/memmap.c
index 3546dc6fe..ff387d93f 100644
--- a/src/arch/i386/firmware/pcbios/memmap.c
+++ b/src/arch/i386/firmware/pcbios/memmap.c
@@ -201,6 +201,13 @@ static int meme820 ( struct memory_map *memmap ) {
break;
}
+ /* If first region is not RAM, assume map is invalid */
+ if ( ( memmap->count == 0 ) &&
+ ( e820buf.type != E820_TYPE_RAM ) ) {
+ DBG ( "INT 15,e820 failed, first entry not RAM\n" );
+ return -EINVAL;
+ }
+
DBG ( "INT 15,e820 region [%llx,%llx) type %d",
e820buf.start, ( e820buf.start + e820buf.len ),
( int ) e820buf.type );