Physical Memory Management
Posted: Thu Jun 12, 2008 4:09 am
Hi
I have spend a day writing a physical memory manager for my kernel using a bitmap to keep track of allocations.
To further tweak what i wrote, i wanted to get some comments from you guru's
The implementation does (seems to) work, but i'm unsure if i haven't left some concrete blocks in it slowing me down And i'm not sure if all my calculations for addresses/offsets/etc. are correct, so that i may miss some areas of memory while searching for free pages, etc.
i attached both the header and c file, maybe somebody has some time to look at it. if not, maybe the code is good enough, to help others out writing their own physical memory manager....
how i use it:
i call SxPhysMemInit(), then i call SxPhysMemAddRegion for each of the mmap entries with type 1 reported by GRUB.
i maybe have to also mention that i use Microsofts Visual C++ to compile this so maybe gcc will not work out of the box...
I have spend a day writing a physical memory manager for my kernel using a bitmap to keep track of allocations.
To further tweak what i wrote, i wanted to get some comments from you guru's
The implementation does (seems to) work, but i'm unsure if i haven't left some concrete blocks in it slowing me down And i'm not sure if all my calculations for addresses/offsets/etc. are correct, so that i may miss some areas of memory while searching for free pages, etc.
i attached both the header and c file, maybe somebody has some time to look at it. if not, maybe the code is good enough, to help others out writing their own physical memory manager....
how i use it:
i call SxPhysMemInit(), then i call SxPhysMemAddRegion for each of the mmap entries with type 1 reported by GRUB.
i maybe have to also mention that i use Microsofts Visual C++ to compile this so maybe gcc will not work out of the box...