I wrote this a many years ago, but it might be a little help. I would highly advise you take Brendan's posts to heart, but this page might help give you a little insight into how to do things. I do not think I take into account reserving certain areas of memory for 16-bit things or legacy hardware, but IIRC I basically give each process it's own view of memory and share certain regions between kernel and user space.
Also one of the functions has a bug in it (I marked it on the page), but since it has been so long I am afraid to try to fix it and I need to setup a skeleton kernel on the X86 so I can test any fix I make on it.
http://wiki.osdev.org/User:Kmcguire/Qui ... ace_Scheme
But, it has a picture or two and some decent example code that might help you kinda see.
Then again it could confuse you more, LOL. But, if you read it with a grain of salt you should be fine.
<edit> I wish I had the time to go back and improve it. I think it just needs some work, and it basically paves the way for doing the simple things. But, like I said it does not address some advanced needs of a mature kernel. But, I mainly wrote it just to get somebody INTO it and then from there let them decide how they want to do it. </edit>
physical memory manager
Re: physical memory manager
Here is what I did, and maybe it will help you.
When I began writing my OS, I knew I didn't want to use Paging. So I didn't, I instead wrote a really cool memory manager. How it works is quite easy, it asks the kernel for the amount of availible memory in bytes, then it finds out where the the kernel and OS code end, marks that as the start of Memory, aligns it on a 512 block boundary, and basically lets me allocate 512 chunk (bytes) at a time, I could easily change this to 256, but anyways, each block is marked in a table where the entrys are 2 bits each. The complexity goes much further.. But it allowed me to mange memory in my own way, without using a lot of memory to do so.
- Matt
When I began writing my OS, I knew I didn't want to use Paging. So I didn't, I instead wrote a really cool memory manager. How it works is quite easy, it asks the kernel for the amount of availible memory in bytes, then it finds out where the the kernel and OS code end, marks that as the start of Memory, aligns it on a 512 block boundary, and basically lets me allocate 512 chunk (bytes) at a time, I could easily change this to 256, but anyways, each block is marked in a table where the entrys are 2 bits each. The complexity goes much further.. But it allowed me to mange memory in my own way, without using a lot of memory to do so.
- Matt
Re: physical memory manager
Ok, I have setup my physical memory manager, which uses a linked list, stored on not used physical pages. The other questions I asked, should be put in another thread, it is related to the virtual memory manager. Thank you to all, you helped a lot