Physical memory allocation
Posted: Sun Nov 07, 2004 8:33 am
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
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