Question about GRUB memory map

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
AMenard
Member
Member
Posts: 67
Joined: Mon Aug 25, 2014 1:27 pm

Question about GRUB memory map

Post 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)?
User avatar
BASICFreak
Member
Member
Posts: 284
Joined: Fri Jan 16, 2009 8:34 pm
Location: Louisiana, USA

Re: Question about GRUB memory map

Post 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)
BOS Source Thanks to GitHub
BOS Expanded Commentary
Both under active development!
Sortie wrote:
  • Don't play the role of an operating systems developer, be one.
  • Be truly afraid of undefined [behavior].
  • Your operating system should be itself, not fight what it is.
AMenard
Member
Member
Posts: 67
Joined: Mon Aug 25, 2014 1:27 pm

Re: Question about GRUB memory map

Post by AMenard »

Thanks!

64-bits address range is quite enough for my need :mrgreen:
Techel
Member
Member
Posts: 215
Joined: Fri Jan 30, 2015 4:57 pm
Location: Germany
Contact:

Re: Question about GRUB memory map

Post by Techel »

Note that you can't use more than 4GiB in Protectedmode.
Without PAE :mrgreen:
Last edited by Techel on Fri Oct 02, 2015 11:31 am, edited 2 times in total.
User avatar
Velko
Member
Member
Posts: 153
Joined: Fri Oct 03, 2008 4:13 am
Location: Ogre, Latvia, EU

Re: Question about GRUB memory map

Post by Velko »

Roflo wrote:Note that you can't use more than 4GiB in Protectedmode.
Why not? Has something bad happened to PAE recently?
If something looks overcomplicated, most likely it is.
kzinti
Member
Member
Posts: 898
Joined: Mon Feb 02, 2015 7:11 pm

Re: Question about GRUB memory map

Post by kzinti »

Yes you can use PAE. It's what he meant by "PEA", probably just a typo.
Techel
Member
Member
Posts: 215
Joined: Fri Jan 30, 2015 4:57 pm
Location: Germany
Contact:

Re: Question about GRUB memory map

Post by Techel »

No I just forgot PAE can be used to extend the space and edited my post ;)
AMenard
Member
Member
Posts: 67
Joined: Mon Aug 25, 2014 1:27 pm

Re: Question about GRUB memory map

Post 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.
Post Reply