diff options
| author | Michael Brown | 2006-05-25 02:00:30 +0200 |
|---|---|---|
| committer | Michael Brown | 2006-05-25 02:00:30 +0200 |
| commit | e4f8d6eed72c38a99d94b11015c0ef63024b296d (patch) | |
| tree | a476a8a75f2ba2889c823b8eff50684546ae0943 /src/arch | |
| parent | Define a struct memory_map with a fixed number of entries, rather than (diff) | |
| download | ipxe-e4f8d6eed72c38a99d94b11015c0ef63024b296d.tar.gz ipxe-e4f8d6eed72c38a99d94b11015c0ef63024b296d.tar.xz ipxe-e4f8d6eed72c38a99d94b11015c0ef63024b296d.zip | |
Add a "count" field to struct memory_map.
Diffstat (limited to 'src/arch')
| -rw-r--r-- | src/arch/i386/firmware/pcbios/memmap.c | 14 | ||||
| -rw-r--r-- | src/arch/i386/include/memmap.h | 3 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/arch/i386/firmware/pcbios/memmap.c b/src/arch/i386/firmware/pcbios/memmap.c index 0a9373a7d..daa1d99cc 100644 --- a/src/arch/i386/firmware/pcbios/memmap.c +++ b/src/arch/i386/firmware/pcbios/memmap.c @@ -138,7 +138,7 @@ static unsigned int extmemsize ( void ) { * @ret rc Return status code */ static int meme820 ( struct memory_map *memmap ) { - unsigned int index = 0; + struct memory_region *region = memmap->regions; uint32_t next = 0; uint32_t smap; unsigned int flags; @@ -169,12 +169,13 @@ static int meme820 ( struct memory_map *memmap ) { if ( e820buf.type != E820_TYPE_RAM ) continue; - memmap->regions[index].start = e820buf.start; - memmap->regions[index].end = e820buf.start + e820buf.len; - index++; + region->start = e820buf.start; + region->end = e820buf.start + e820buf.len; + region++; + memmap->count++; } while ( ( next != 0 ) && - ( index < ( sizeof ( memmap->regions ) / - sizeof ( memmap->regions[0] ) ) ) ); + ( memmap->count < ( sizeof ( memmap->regions ) / + sizeof ( memmap->regions[0] ) ) ) ); return 0; } @@ -202,4 +203,5 @@ void get_memmap ( struct memory_map *memmap ) { memmap->regions[0].end = ( basemem * 1024 ); memmap->regions[1].start = 0x100000; memmap->regions[1].end = 0x100000 + ( extmem * 1024 ); + memmap->count = 2; } diff --git a/src/arch/i386/include/memmap.h b/src/arch/i386/include/memmap.h index e514784de..ccba14b68 100644 --- a/src/arch/i386/include/memmap.h +++ b/src/arch/i386/include/memmap.h @@ -23,7 +23,10 @@ struct memory_region { /** A memory map */ struct memory_map { + /** Memory regions */ struct memory_region regions[MAX_MEMORY_REGIONS]; + /** Number of used regions */ + unsigned int count; }; extern void get_memmap ( struct memory_map *memmap ); |
