Preserving the 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
User avatar
CocaCola
Member
Member
Posts: 36
Joined: Fri Sep 07, 2012 9:11 am

Preserving the GRUB memory map

Post by CocaCola »

Hello.
I'm using the memory map provided by GRUB to see available memory and reserved memory.
I want to overwrite the available memory, but I'm afraid that I'll lose the GRUB memory map.

I figure the simplest solution would be to just not overwrite the memory map in the first place.
However I would like to hear other ideas, for solutions more elegant than "skipping" over the mmap.

Thanks.
Gogeta70
Member
Member
Posts: 28
Joined: Thu Jun 06, 2013 11:15 am

Re: Preserving the GRUB memory map

Post by Gogeta70 »

Use grub's memory map to initialize your physical memory manager. Your PMM should keep track of used and available memory, so once it's initialized, you don't need grub's memory map anymore. For the reserved memory sections in grub's memory map, just mark the memory as used in your PMM.

In my OS, i use a bitmap to mark used regions of memory. Seeing as it fits in with virtual memory pages, i have 1 bit in the bitmap represent a 4kb block of physical memory.

http://wiki.osdev.org/Page_Frame_Allocation
Mikemk
Member
Member
Posts: 409
Joined: Sat Oct 22, 2011 12:27 pm

Re: Preserving the GRUB memory map

Post by Mikemk »

If you want to keep the memory map after parsing it, just mark the area of memory it's in as used.
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
Post Reply