Memory management design
Posted: Mon Dec 22, 2008 12:17 pm
Hello. I'm starting with OS Dev. I'm planning to write a microkernel. I have some ideas about mm but I'm afraid that when I'll be implementing multitaking it will be a bit too late to make significant change (or rather - I'd prefere to know that before).
Paging
1. Internal (for kernel) API
More or less those methods (I decided to have pseudo-object structures) - adding rings/access rights should be simple:
- get_page_size
- allocate (where, size) - allocates size pages starting at [virtual address] where (-1 if anywhere)
- fake_allocate (where, size, callback) - allocates dummy size pages at where. On access call callback
- release (page) - release a page
- lookup (address) - returns hardware and/or kernel address of address
- rlookup (hwaddress) - returns address in pagetable (NULL if not existing) of kernel/hardware address
- map (page, to) - map page (in hardware/kernel addresspace) to to address (any if to == -1)
2. Implementation (for x86)
The addresspace for kernel is identity of hardware memory (done in 4mb pages). Since it is suppose to be microkernel I don't think that I'll have much swapping of kernel memory.
The rest is 'traditional' v. memory.
Second question is do I need to have the same mapping of the part of memory (code for switching tasks) or TSS will handle it?
Allocation
I've read a few pages about memory management. However I get little information about SLAB allocations. Is it suitable for newbie or should I choose something simpler first?
Sorry for asking those, probably basic, questions - but I STFW (reading till n'th page in google) and I found little at this topics.
Paging
1. Internal (for kernel) API
More or less those methods (I decided to have pseudo-object structures) - adding rings/access rights should be simple:
- get_page_size
- allocate (where, size) - allocates size pages starting at [virtual address] where (-1 if anywhere)
- fake_allocate (where, size, callback) - allocates dummy size pages at where. On access call callback
- release (page) - release a page
- lookup (address) - returns hardware and/or kernel address of address
- rlookup (hwaddress) - returns address in pagetable (NULL if not existing) of kernel/hardware address
- map (page, to) - map page (in hardware/kernel addresspace) to to address (any if to == -1)
2. Implementation (for x86)
The addresspace for kernel is identity of hardware memory (done in 4mb pages). Since it is suppose to be microkernel I don't think that I'll have much swapping of kernel memory.
The rest is 'traditional' v. memory.
Second question is do I need to have the same mapping of the part of memory (code for switching tasks) or TSS will handle it?
Allocation
I've read a few pages about memory management. However I get little information about SLAB allocations. Is it suitable for newbie or should I choose something simpler first?
Sorry for asking those, probably basic, questions - but I STFW (reading till n'th page in google) and I found little at this topics.