Skip to content

Commit

Permalink
Add a "count" field to struct memory_map.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Brown committed May 25, 2006
1 parent 986f6ff commit e4f8d6e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/arch/i386/firmware/pcbios/memmap.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
3 changes: 3 additions & 0 deletions src/arch/i386/include/memmap.h
Expand Up @@ -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 );
Expand Down

0 comments on commit e4f8d6e

Please sign in to comment.