Submitted For Peer Review: My Memory Manager / Paging Mech.
Posted: Fri Oct 05, 2007 8:14 am
Located at address: http://dev.drcoders.com/ukon/review/
You will find a couple of files.
My Physical Memory Allocator called: allocator.c and .h
My Virtual Memory Allocator (Paging): called pageman.c and .h
My Higher Level Memory Allocator (malloc): Borrowed from old Freedows code
Lastly: my gdt.c which is used from bran, and the mm_low.s which includes more code from bran along with cr0 and cr3 access registers...
My purpose of this message is to submit this code to my peers for review. I would like to know where I have areas of improvment, where I may have designed pit-falls, if there are any blantant bugs... etc etc etc... I will be getting back into OS dev, and rewriting my kernel. I was hoping to be able to reuse much of my mem/paging code.
Its not to much code, and it does have *some* comments.
I believe that the code is fairly stable and seems to run without any issues.
Below is how the code is used (initialized).
Thanks in advance for your help.
Rich
You will find a couple of files.
My Physical Memory Allocator called: allocator.c and .h
My Virtual Memory Allocator (Paging): called pageman.c and .h
My Higher Level Memory Allocator (malloc): Borrowed from old Freedows code
Lastly: my gdt.c which is used from bran, and the mm_low.s which includes more code from bran along with cr0 and cr3 access registers...
My purpose of this message is to submit this code to my peers for review. I would like to know where I have areas of improvment, where I may have designed pit-falls, if there are any blantant bugs... etc etc etc... I will be getting back into OS dev, and rewriting my kernel. I was hoping to be able to reuse much of my mem/paging code.
Its not to much code, and it does have *some* comments.
I believe that the code is fairly stable and seems to run without any issues.
Below is how the code is used (initialized).
Thanks in advance for your help.
Rich
Code: Select all
gdt_install();
...
//kernel_end is a label at the end of my linker script.
// the + 256k is to give it some breaking room before the phys memory map starts
// The second number is the number of bytes required to represent each page as a bit
mm_install(kernel_end + (256 * 1024), (mbd->mem_upper + 1024) / 32);
//Now we loop through grubs memory mapper and reserve everything it tells us to...
mmap = (memory_map_t *) (mbd->mmap_addr);
while((unsigned long) mmap < mbd->mmap_addr + mbd->mmap_length)
{
if (mmap->type != 1)
mm_reserve(mmap->base_addr_low,mmap->length_low);
mmap = (memory_map_t *) ((unsigned long) mmap + mmap->size + sizeof (mmap->size));
}
//Start the VMM (Paging)
vmm_install();