Browse Source

[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").
tags/v0.9.7
Marty Connor 16 years ago
parent
commit
8674bc05a0
1 changed files with 7 additions and 0 deletions
  1. 7
    0
      src/arch/i386/firmware/pcbios/memmap.c

+ 7
- 0
src/arch/i386/firmware/pcbios/memmap.c View File

@@ -201,6 +201,13 @@ static int meme820 ( struct memory_map *memmap ) {
201 201
 			break;
202 202
 		}
203 203
 
204
+		/* If first region is not RAM, assume map is invalid */
205
+		if ( ( memmap->count == 0 ) &&
206
+		     ( e820buf.type != E820_TYPE_RAM ) ) {
207
+		       DBG ( "INT 15,e820 failed, first entry not RAM\n" );
208
+		       return -EINVAL;
209
+		}
210
+
204 211
 		DBG ( "INT 15,e820 region [%llx,%llx) type %d",
205 212
 		      e820buf.start, ( e820buf.start + e820buf.len ),
206 213
 		      ( int ) e820buf.type );

Loading…
Cancel
Save