Detecting Memory (x86): Difference between revisions
Jump to navigation
Jump to search
[unchecked revision] | [unchecked revision] |
Content deleted Content added
→Getting an E820 Memory Map: line break |
m rename the grub mmap to explicitly say "entry", since it's an entry rather than a whole map. |
||
Line 348: | Line 348: | ||
<source lang="c"> |
<source lang="c"> |
||
typedef struct |
typedef struct mmap_entry { |
||
unsigned int size; |
unsigned int size; |
||
unsigned int base_addr_low,base_addr_high; |
unsigned int base_addr_low,base_addr_high; |
||
Line 355: | Line 355: | ||
// You can also use: unsigned long long int length; if supported. |
// You can also use: unsigned long long int length; if supported. |
||
unsigned int type; |
unsigned int type; |
||
} mmap_entry_t; |
|||
} multiboot_memory_map_t; |
|||
int main(multiboot_info* mbt, unsigned int magic) { |
int main(multiboot_info* mbt, unsigned int magic) { |
||
... |
... |
||
mmap_entry_t* entry = mbt->mmap_addr; |
|||
while( |
while(entry < mbt->mmap_addr + mbt->mmap_length) { |
||
// do something with the entry |
|||
... |
|||
entry = (mmap_entry_t*) ((unsigned int) entry + entry->size + sizeof(entry->size)); |
|||
} |
} |
||
... |
... |