About MMU

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
huxuelei
Member
Member
Posts: 35
Joined: Tue May 27, 2008 8:32 am

About MMU

Post by huxuelei »

Hi, I am about to write MMU.
I have seen some articles about MMU.
But I don't know the first step about writting MMU is enable paging or wirte malloc and free?
User avatar
Alboin
Member
Member
Posts: 1466
Joined: Thu Jan 04, 2007 3:29 pm
Location: Noricum and Pannonia

Re: About MMU

Post by Alboin »

Hi*,

You're going to need to get paging up and going first. There's a nice tutorial on osdever, and there are quite a few more floating around here. (JamesM's, the wiki, etc. - If you're really lost, JamesM's are very comprehensive, so that might make life easier.) There's also the Intel manauals, which, are always useful on these technical matters.

After paging, or nearly after paging, you'll need to be able to allocate physical pages, that is, each actual slab of 4kb that your RAM *actually* has. A stack based approach is generally the easiest. (See here)

Once you can manage your physical pages, you'll need to be able to manage virtual 'regions' of memory, or multiple pages of consecutive virtual memory. Two ways to do this can be found towards the bottom of the aforementioned wiki page on page frame allocation.

On top of this finally comes your malloc. Malloc is, in fact, your last step. dlmalloc is popular, and I hear it is quite nice. (Not having used it myself.)

Have fun,
Alboin

*Everyone else seems to be doing it.
C8H10N4O2 | #446691 | Trust the nodes.
Post Reply