I'm building a x86 32bit micro-kernel and therefore, I have to implement a physical memory manager. However i'm confused about how to do this.
My kernel currently works as follows:
- the kernel is loaded by grub together with a memory map.
- Basic paging is enabled, mapping the kernel at 3GB and identity mapping the first 4MB
- a very basic display driver is initialized
In order to know the reserved area's and the total memory, i have to read the multiboot data. however this confuses me.
First of all, I have to find a place to store my bitmap without overwriting (parts of) the multiboot data. I am planning to use boot modules in the future, so i have to be extra careful not to overwrite them. since those modules could be loaded anywhere, and not necessarily next to each other. But i am not sure about the best way to do this.
Second, since i have a higher-half kernel and paging enabled, i must ensure that the multiboot data is mapped-in correctly.
So my question is: What is a good way to do this? Could somebody maybe give me an example or something?
Thanks a lot!