Virtual Addresses
Posted: Tue Dec 31, 2002 5:07 am
I have built my own physical frame allocator, using two bitmaps (for superpages and pages) for allocating real (physical) memory.
Now it's time to implement the virtual memory allocator. People told me to use a pointer to the end of the bss section (that is the heap) and use a free list of blocks. On each malloc(), I should look into this free list, and if there is no more free blocks, I should increment the heap pointer and add it to the free list. If I have found a block big enough, I should return a pointer to it.
But that's my problem: I don't have the virtual address! So how can I do this? Besides, how is a virtual address set up? I always thought it depends on which page table and page directory I use. Or can I just map a physical address to any virtual address (I determine the virtual address)?
best regards,
A. Blessing
Now it's time to implement the virtual memory allocator. People told me to use a pointer to the end of the bss section (that is the heap) and use a free list of blocks. On each malloc(), I should look into this free list, and if there is no more free blocks, I should increment the heap pointer and add it to the free list. If I have found a block big enough, I should return a pointer to it.
But that's my problem: I don't have the virtual address! So how can I do this? Besides, how is a virtual address set up? I always thought it depends on which page table and page directory I use. Or can I just map a physical address to any virtual address (I determine the virtual address)?
best regards,
A. Blessing