Open arthurmco opened 6 years ago
I'd like to help with this issue. I'm learning about kernels and I really would like to help design one.
Nice!
What are your ideas for this memory manager?
I'm honestly not sure, would you be able to help me with designing it? I understand the theory behind memory management but I've yet to implement it. Do you have any suggestions?
I was thinking about starting with a simple bitmap-based physical memory manager, just to get started, and improving it over time.
In it, each bit would represent a physical page of memory, 4kb.
I am still reading about it, but I think it's OK for a start...
So it's going to be a heap of memory with each block pointing to 4KB of memory?
No, more like this: http://wiki.osdev.org/Page_Frame_Allocation#Bitmap
Just a simple array for the bitmap. A heap would consume too much memory.
I started doing the physical memory manager in a68ca7f.
It does basic things, but can be improved.
I did some TODO items in the PMM.cpp file, to be solved. I will replicate them here:
[x] Use allocation flags, for each one of the memory areas
This envolves setting a flag for each area that belongs to a determined group, e.g, memory < 16 MB might be used by some old devices, like the floppy or old hardware, that can't use a bigger physical address
[ ] The CheckPages() method.
It's missing. We need a function that checks if we can allocate a big area. This is intended to be used by the VMM, that needs to allocate a certain quantity of memory, but it doesn't need to be physically contiguous. So, it can allocate, for example, 2 uncontiguous blocks of 8 pages if a single, contiguous block of 16 pages can't be allocated at once.
[ ] Detect overlapping zones, alert the user and do something sane Some real hardware overlap memory zones, like an old computer I have. Maybe detect what types they are and do something.
Design and create a physical memory manager, so we know how much memory we have, and what blocks are occupied
This will be the base for the virtual memory manager, and for virtual memory allocations, and paging
This might help with directions