GRUB memory map - end address?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
jayt
Posts: 17
Joined: Mon Aug 26, 2013 1:40 am

GRUB memory map - end address?

Post by jayt »

It may sound a stupid question but how can I find out where all the multiboot structure ends (the address) in the RAM?

I know that GRUB gives the pointer to its beginning, but where is the end?
My memory manager needs this to know to mark the RAM pages as used.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: GRUB memory map - end address?

Post by Combuster »

Ever heard of sizeof() ? How does it (not) apply?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: GRUB memory map - end address?

Post by AJ »

Hi,

For the Multiboot 1 structure, you know the size, so just add that on (sizeof()). For Multiboot 2, you can read the structure size from the structure itself (including tags).

If you want to know where everything is (including the memory map etc...), you cannot assume that all the headers are contiguous. The best way may therefore be to cache the headers prior to marking any RAM pages as used (remember to mark and modules as 'used' too).

Cheers,
Adam
Post Reply