Page 1 of 1

Physical memory allocation

Posted: Sun Nov 07, 2004 8:33 am
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 ;)

Re:Physical memory allocation

Posted: Sun Nov 07, 2004 5:03 pm
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 ?

Re:Physical memory allocation

Posted: Sun Nov 07, 2004 5:42 pm
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?

Re:Physical memory allocation

Posted: Mon Nov 08, 2004 3:28 am
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 :)