Paging design, Lower half kernel, potential problems?

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
User avatar
Colonel Kernel
Member
Member
Posts: 1437
Joined: Tue Oct 17, 2006 6:06 pm
Location: Vancouver, BC, Canada
Contact:

Re: Paging design, Lower half kernel, potential problems?

Post by Colonel Kernel »

Sounds good to me.
Top three reasons why my OS project died:
  1. Too much overtime at work
  2. Got married
  3. My brain got stuck in an infinite loop while trying to design the memory manager
Don't let this happen to you!
mangaluve
Member
Member
Posts: 110
Joined: Mon Feb 23, 2009 6:53 am

Re: Paging design, Lower half kernel, potential problems?

Post by mangaluve »

So where do you recommend that I put my kernel then? I need the last 4 MB of my virtual memory to the self-mapping of my page directory, but should the kernel end just before those 4 MB?
User avatar
Colonel Kernel
Member
Member
Posts: 1437
Joined: Tue Oct 17, 2006 6:06 pm
Location: Vancouver, BC, Canada
Contact:

Re: Paging design, Lower half kernel, potential problems?

Post by Colonel Kernel »

You don't actually need to self-map your page directory right at the end of the address space. You can do it wherever you want. Mine is self-mapped 12MB after my kernel code in the virtual address space.

Where to put your kernel really depends on what kind of kernel it is. Higher "half" is not necessarily to be taken literally. If your kernel is monolithic, you'll need more address space dedicated to the kernel. If it's a microkernel, you'll need less. Mine is a microkernel, and my kernel space starts at 0xE0000000 for example. My kernel code starts at 0xE0100000, and the current page directory is self-mapped such that all the page tables start at 0xE1000000. Where you choose to put things depends on how your own kernel is going to use memory, but in general I suggest keeping big contiguous regions of virtual address space free for kernel use.
Top three reasons why my OS project died:
  1. Too much overtime at work
  2. Got married
  3. My brain got stuck in an infinite loop while trying to design the memory manager
Don't let this happen to you!
Post Reply