Physical memory allocation

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
ohboy

Physical memory allocation

Post by ohboy »

What is the best way to allocate physical memory to be used by page directories and tables? And how do I make it not to collide with my other physical allocation routine (a stack)?
Are the addresses in a page directory virtual or physical?
If they're virtual, I can just allocate 4kb virtual memory to be used by the page dir, and when I map a page I create a new page table if needed (allocating virtual memory for it). But then there's a problem, how do I map a page when there is no page table?
And another problem, all those virtual addresses used by the page dir are mapped in another process' address space (the kernel's), so I would have to use the kernel's address space when I map something. Or, should I create a shared memory region with all the page dir -> page table mappings, and then have a special heap, only to be used to allocate virtual memory for page dirs/tables?

Many questions, but I would really like some of them answered ;)
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Physical memory allocation

Post by Pype.Clicker »

i guess you should get a look at the FAQ first, and at this page too.

Directory and tables does not *allocate* pages: they assign physical addresses to virtual addresses.
And another problem, all those virtual addresses used by the page dir are mapped in another process' address space (the kernel's), so I would have to use the kernel's address space when I map something. Or, should I create a shared memory region with all the page dir -> page table mappings, and then have a special heap, only to be used to allocate virtual memory for page dirs/tables?
Sorry, i just get the feeling you're completely confused about the whole thing, but i cannot figure what troubles you nor how you'd like to fix it ...

Maybe you could rephrase that after reading the above-mentionned pages ?
ohboy

Re:Physical memory allocation

Post by ohboy »

Sorry for that mess...
I think my problem was that I somehow thought the addresses contained in page directory entries were virtual addresses... heh

Pype, I've got a question about Clicker ;) I'm quite interested in your system KDS, do you have any docs where I can read a little about the concept?
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Physical memory allocation

Post by Pype.Clicker »

http://clicker.sourceforge.net/wiclicker/index.php/KDS should collect everything i have available ... If you need more precisions, feel free to bug me on ICQ :)
Post Reply