I wonder if I ever need to allocate a specific address in my physical memory manager?
If not, it would make implementation much easier, as I just keep a pointer to the first free page and every free page contains a pointer to the next free page, resulting in O(1) for allocating and freeing.
But if I ever need to allocate/free a specific address, this algorithm becomes unfeasible, because it would result in O(n) (traversing all pages until I have found the address)
For that case I thought of something like
Code: Select all
struct PhysicalMemoryChunk_t {
size_t mSize;
PhysicalMemoryChunk_t *mPrev;
PhysicalMemoryChunk_t *mNext;
PhysicalMemoryChunk_t *mParentByAddress;
PhysicalMemoryChunk_t *mLeftByAddress;
PhysicalMemoryChunk_t *mRightByAddress;
PhysicalMemoryChunk_t *mParentBySize;
PhysicalMemoryChunk_t *mLeftBySize;
PhysicalMemoryChunk_t *mRightBySize;
};
So, is stack-like for a physical page frame allocator really good enough? I heard that nearly all devices today are capable of uncontigous DMA. Is this correct? How is it in regard of Bochs and especially QEMU?
Did I made a thinking mistake in my alternate approach?
Best regards
Sebi