Paging design, Lower half kernel, potential problems?
- Colonel Kernel
- Member
- Posts: 1437
- Joined: Tue Oct 17, 2006 6:06 pm
- Location: Vancouver, BC, Canada
- Contact:
Re: Paging design, Lower half kernel, potential problems?
Sounds good to me.
Top three reasons why my OS project died:
- Too much overtime at work
- Got married
- My brain got stuck in an infinite loop while trying to design the memory manager
Re: Paging design, Lower half kernel, potential problems?
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?
- Colonel Kernel
- Member
- Posts: 1437
- Joined: Tue Oct 17, 2006 6:06 pm
- Location: Vancouver, BC, Canada
- Contact:
Re: Paging design, Lower half kernel, potential problems?
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.
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:
- Too much overtime at work
- Got married
- My brain got stuck in an infinite loop while trying to design the memory manager