Let me just quote my source file here:
Code: Select all
// Memory Index
//
// The memory index takes the form of a bitmap.
// For every 64 bits, there is one bit in the
// bitmap signaling if it is allocated or free.
// This works out to about ~1.5% memory usage,
// and this indexes all of the addressable RAM.
// Therefore, the minimum amount of RAM that can
// be allocated is 64 bits (8 bytes), which is
// the perfect amount for an x64-based kernel.
Anyway, there is a few things I need to know before I get started.
A. How do I obtain the amount of RAM that a computer has?
B. How do I dynamically allocate the space for the memory index?
I can't go with highest possible value, because that would be equal to 2TB, which would require an allocation of 32GB, which won't work out for me as I only have 16GB of RAM in my computer to begin with, and it also won't work
for majority of computers. I also can't use the memory allocator because it needs the table first...
C. Is 8 bytes minimum a reasonable amount?
Also note this must work under UEFI.