feat: DTB now populates VMBootMemoryMap structure.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
#include <VM/PMM.h>
|
||||
|
||||
static inline Size BitmapGetByteIndex(Address address) {
|
||||
return (address / kVMPageSize) / kVMBlocksPerByte;
|
||||
}
|
||||
|
||||
static inline UInt8 BitmapGetBitOffset(Address address) {
|
||||
return (UInt8)((address / kVMPageSize) % kVMBlocksPerByte);
|
||||
}
|
||||
|
||||
static inline Boolean BitmapTest(const MemoryPointer bitmap, Address address) {
|
||||
return (bitmap[BitmapGetByteIndex(address)] & (1U << BitmapGetBitOffset(address))) != 0;
|
||||
}
|
||||
|
||||
static inline void BitmapSet(MemoryPointer bitmap, Address address) {
|
||||
bitmap[BitmapGetByteIndex(address)] |= (1U << BitmapGetBitOffset(address));
|
||||
}
|
||||
|
||||
static inline void BitmapUnset(MemoryPointer bitmap, Address address) {
|
||||
bitmap[BitmapGetByteIndex(address)] &= ~(1U << BitmapGetBitOffset(address));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user