Page 1 of 1
GRUB memory map location
Posted: Sun Jan 18, 2009 12:06 pm
by giszo
Hi!
I just run throught the multiboot specificaiton in the hope that I found something about the location of the memory map provided by the GRUB, but unfortunately I didn't found anything. Was I a bit of cursory and missed something or it's really not specified and can be everywhere?
I just use the memory right after my kernel binary to manage memory pages (this is some kind of bitmap) and if the GRUB memory map can be everywhere I may override it with my bitmap. My question is that should I create a backup of the GRUB memory map before I initialize my bitmap or the map is located in a specified location and I can make sure somehow that I won't override it?
Thanks,
giszo
Re: GRUB memory map location
Posted: Sun Jan 18, 2009 12:43 pm
by Hangin10
The address and length of the memory map (which GRUB gets using a BIOS interrupt) are provided in the multiboot
structure passed in EBX to your kernel.
If I remember correctly, the address is the 12th 32bit value, and the length is the 11th (and is in bytes).
EDIT:
http://www.gnu.org/software/grub/manual ... ion-format
Re: GRUB memory map location
Posted: Sun Jan 18, 2009 1:09 pm
by giszo
Hangin10 wrote:The address and length of the memory map (which GRUB gets using a BIOS interrupt) are provided in the multiboot
structure passed in EBX to your kernel.
If I remember correctly, the address is the 12th 32bit value, and the length is the 11th (and is in bytes).
EDIT:
http://www.gnu.org/software/grub/manual ... ion-format
Thanks, but as I meant before I've read the multiboot documentation. I just wanted to know if the possible addresses for the GRUB memory map is limited to a range (for example to the lower 1mb of memory, etc.) or not.
Re: GRUB memory map location
Posted: Sun Jan 18, 2009 1:46 pm
by Hangin10
, totally misread.
It's usually under 1MB, because it's just the results of a BIOS interrupt.
I don't think GRUB ever moves it elsewhere.
EDIT: If anyone else has more specific info on this, it would be appreciated.
I've had similar thoughts, as I've wondered what area would be not
used by GRUB, but provide for a nice, large stack before paging is ready.
Re: GRUB memory map location
Posted: Sun Jan 18, 2009 7:48 pm
by Brendan
Hi,
Hangin10 wrote:EDIT: If anyone else has more specific info on this, it would be appreciated.
I've had similar thoughts, as I've wondered what area would be not
used by GRUB, but provide for a nice, large stack before paging is ready.
My thoughts are that if you're writing a "multi-boot compliant" kernel (or boot loader or whatever), then you can't assume the boot manager will be GRUB and won't be something else that behaves completely differently. You'd only be able to rely on what the multi-boot specification says, and the multi-boot specification doesn't say anything about the permitted location/s for anything. To get around this I only touch data in my code's ".data" and ".bss" sections until memory management is setup (to make sure I can't trash data provided by the boot manager before I need it).
Cheers,
Brendan