Page 1 of 1

Question about GRUB memory map

Posted: Thu Oct 01, 2015 11:49 am
by AMenard
Hi,

I'm just starting in OS dev and I'm presently trying to hunt down all the information that I need in preparation for my first attempt at writing my own kernel.
In that process I came to the point of using GRUB to generate a memory map that I could use.

My question is: Does GRUB memory map includes all the memory available on the system or is there a size limit (ala 32bit <4gig)?

Re: Question about GRUB memory map

Posted: Thu Oct 01, 2015 12:26 pm
by BASICFreak
AMenard wrote:Does GRUB memory map includes all the memory available on the system
The quick answer is mostly.
or is there a size limit (ala 32bit <4gig)?
The limit is 64-bit address ranges.

GRUB uses the same BIOS methods to grab a memory map (when it can) as anyone else would use in real mode. INT 0x15 E820h, Which uses QWORDS (64-bit) base and length. If it cannot get a map from there it has a few fallback routines which may or may not give the full range in RAM.

Detecting Memory (x86) - Getting a GRUB Memory Map
Grub Multiboot Spec Tutorial (Best one I know of)

Re: Question about GRUB memory map

Posted: Thu Oct 01, 2015 12:37 pm
by AMenard
Thanks!

64-bits address range is quite enough for my need :mrgreen:

Re: Question about GRUB memory map

Posted: Fri Oct 02, 2015 12:13 am
by Techel
Note that you can't use more than 4GiB in Protectedmode.
Without PAE :mrgreen:

Re: Question about GRUB memory map

Posted: Fri Oct 02, 2015 12:26 am
by Velko
Roflo wrote:Note that you can't use more than 4GiB in Protectedmode.
Why not? Has something bad happened to PAE recently?

Re: Question about GRUB memory map

Posted: Fri Oct 02, 2015 11:25 am
by kzinti
Yes you can use PAE. It's what he meant by "PEA", probably just a typo.

Re: Question about GRUB memory map

Posted: Fri Oct 02, 2015 11:32 am
by Techel
No I just forgot PAE can be used to extend the space and edited my post ;)

Re: Question about GRUB memory map

Posted: Tue Oct 06, 2015 12:00 pm
by AMenard
I ultimately intend to run in x86_64 mode, but I understand that I still have to set the PAE to do so after reading the "Entering Long Long Mode" entry on the wiki.
I'm in no hurry and I'm in full research mode at the moment. I'm in the pen and paper stage of my os so to speak :mrgreen:

I prefer to work out a blueprint before I start writing code. Less chance of pumping out spaghetti code that way. I also have to get back to Tannenbaum and brush up my x86 assembly skill. I haven't use it for quite a while.