mirror of
https://github.com/xcat2/xNBA.git
synced 2024-12-23 19:51:46 +00:00
Add a "count" field to struct memory_map.
This commit is contained in:
parent
986f6ffff1
commit
e4f8d6eed7
@ -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;
|
||||
}
|
||||
|
@ -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 );
|
||||
|
Loading…
Reference in New Issue
Block a user