diff --git a/Core/Memory/Memory.cpp b/Core/Memory/Memory.cpp index f1d62fa4..b8b22aaa 100644 --- a/Core/Memory/Memory.cpp +++ b/Core/Memory/Memory.cpp @@ -198,9 +198,9 @@ __no_instrument_function void InitializeMemoryManagement(BootInfo *Info) trace("Applying new page table from address %p", KernelPageTable); #ifdef DEBUG debug("Kernel:"); - tracepagetable(KernelPageTable); + // tracepagetable(KernelPageTable); debug("Userspace:"); - tracepagetable(UserspaceKernelOnlyPageTable); + // tracepagetable(UserspaceKernelOnlyPageTable); #endif #if defined(__amd64__) || defined(__i386__) asmv("mov %0, %%cr3" ::"r"(KernelPageTable)); diff --git a/Core/Memory/VirtualMemoryManager.cpp b/Core/Memory/VirtualMemoryManager.cpp index 2d6922ec..82243049 100644 --- a/Core/Memory/VirtualMemoryManager.cpp +++ b/Core/Memory/VirtualMemoryManager.cpp @@ -50,9 +50,9 @@ namespace Memory } PageMapIndexer Index = PageMapIndexer((uint64_t)VirtualAddress); + PageMapLevel4 PML4 = this->Table->Entries[Index.PMLIndex]; PageDirectoryPointerTableEntryPtr *PDPTEPtr = nullptr; - if (!PML4.Present) { PDPTEPtr = (PageDirectoryPointerTableEntryPtr *)KernelAllocator.RequestPage(); @@ -128,8 +128,8 @@ namespace Memory if (!this->Check(VirtualAddress, (PTFlag)Flags)) // quick workaround just to see where it fails { - this->Check(VirtualAddress, (PTFlag)Flags); - warn("Failed to map %#lx - %#lx with flags: " BYTE_TO_BINARY_PATTERN, VirtualAddress, PhysicalAddress, BYTE_TO_BINARY(Flags)); + // this->Check(VirtualAddress, (PTFlag)Flags); + // warn("Failed to map %#lx - %#lx with flags: " BYTE_TO_BINARY_PATTERN, VirtualAddress, PhysicalAddress, BYTE_TO_BINARY(Flags)); } #endif } diff --git a/include/memory.hpp b/include/memory.hpp index 6cf7d128..9c3b3e11 100644 --- a/include/memory.hpp +++ b/include/memory.hpp @@ -169,7 +169,7 @@ namespace Memory bool Global : 1; // 8 uint8_t Available0 : 3; // 9-11 uint64_t Address : 40; // 12-51 - uint32_t Available1 : 11; // 52-58 + uint32_t Available1 : 7; // 52-58 bool ProtectionKey : 4; // 59-62 bool ExecuteDisable : 1; // 63 }; @@ -215,15 +215,15 @@ namespace Memory { struct { - bool Present : 1; // 0 - bool ReadWrite : 1; // 1 - bool UserSupervisor : 1; // 2 - bool WriteThrough : 1; // 3 - bool CacheDisable : 1; // 4 - bool Accessed : 1; // 5 - bool Available0 : 1; // 6 - bool PageSize : 1; // 7 - uint8_t Available1 : 4; // 8-11 + bool Present : 1; // 0 + bool ReadWrite : 1; // 1 + bool UserSupervisor : 1; // 2 + bool WriteThrough : 1; // 3 + bool CacheDisable : 1; // 4 + bool Accessed : 1; // 5 + bool Available0 : 1; // 6 + bool PageSize : 1; // 7 + uint8_t Available1 : 4; // 8-11 uint64_t Address : 40; // 12-51 uint32_t Available2 : 11; // 52-62 bool ExecuteDisable : 1; // 63 @@ -270,15 +270,15 @@ namespace Memory { struct { - bool Present : 1; // 0 - bool ReadWrite : 1; // 1 - bool UserSupervisor : 1; // 2 - bool WriteThrough : 1; // 3 - bool CacheDisable : 1; // 4 - bool Accessed : 1; // 5 - bool Available0 : 1; // 6 - bool PageSize : 1; // 7 - uint8_t Available1 : 4; // 8-11 + bool Present : 1; // 0 + bool ReadWrite : 1; // 1 + bool UserSupervisor : 1; // 2 + bool WriteThrough : 1; // 3 + bool CacheDisable : 1; // 4 + bool Accessed : 1; // 5 + bool Available0 : 1; // 6 + bool PageSize : 1; // 7 + uint8_t Available1 : 4; // 8-11 uint64_t Address : 40; // 12-51 uint32_t Available2 : 11; // 52-62 bool ExecuteDisable : 1; // 63 @@ -325,15 +325,15 @@ namespace Memory { struct { - bool Present : 1; // 0 - bool ReadWrite : 1; // 1 - bool UserSupervisor : 1; // 2 - bool WriteThrough : 1; // 3 - bool CacheDisable : 1; // 4 - bool Accessed : 1; // 5 - bool Available0 : 1; // 6 - bool Reserved0 : 1; // 7 - uint8_t Available1 : 4; // 8-11 + bool Present : 1; // 0 + bool ReadWrite : 1; // 1 + bool UserSupervisor : 1; // 2 + bool WriteThrough : 1; // 3 + bool CacheDisable : 1; // 4 + bool Accessed : 1; // 5 + bool Available0 : 1; // 6 + bool Reserved0 : 1; // 7 + uint8_t Available1 : 4; // 8-11 uint64_t Address : 40; // 12-51 uint32_t Available2 : 11; // 52-62 bool ExecuteDisable : 1; // 63