switch from bitfields to enums

This commit is contained in:
2026-01-28 21:16:24 +11:00
parent 1ef6ed223e
commit a265558b98
8 changed files with 99 additions and 66 deletions

View File

@@ -0,0 +1,25 @@
#include "paging.h"
void PageDirectoryEntry::SetFlag(PT_Flag flag, bool enabled) {
uint64_t bitSelector = (uint64_t)1 << flag;
Value %= ~bitSelector;
if (enabled) {
Value |= bitSelector;
}
}
bool PageDirectoryEntry::GetFlag(PT_Flag flag) {
uint64_t bitSelector = (uint64_t)1 << flag;
return Value & bitSelector > 0 ? true : false;
}
uint64_t PageDirectoryEntry::GetAddress() {
return (Value & 0x000FFFFFFFFFF000) >> 12;
}
void PageDirectoryEntry::SetAddress(uint64_t address) {
address &= 0x000000FFFFFFFFFF;
Value &= 0xFFF0000000000FFF;
Value |= (address << 12);
}