Page 1 of 1

GRUB memory map - end address?

Posted: Wed Sep 04, 2013 8:43 am
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.

Re: GRUB memory map - end address?

Posted: Wed Sep 04, 2013 9:05 am
by Combuster
Ever heard of sizeof() ? How does it (not) apply?

Re: GRUB memory map - end address?

Posted: Wed Sep 04, 2013 9:09 am
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