MCPcopy Create free account
hub / github.com/Simple-XX/SimpleKernel / GetMapping

Method GetMapping

src/memory/virtual_memory.cpp:141–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141auto VirtualMemory::GetMapping(void* page_dir, void* virtual_addr)
142 -> Expected<void*> {
143 assert(page_dir != nullptr && "GetMapping: page_dir is null");
144
145 auto pte_result = FindPageTableEntry(page_dir, virtual_addr, false);
146 if (!pte_result.has_value()) {
147 return std::unexpected(Error(ErrorCode::kVmPageNotMapped));
148 }
149
150 auto pte = pte_result.value();
151
152 if (!cpu_io::virtual_memory::IsPageTableEntryValid(*pte)) {
153 return std::unexpected(Error(ErrorCode::kVmPageNotMapped));
154 }
155
156 return reinterpret_cast<void*>(
157 cpu_io::virtual_memory::PageTableEntryToPhysical(*pte));
158}
159
160auto VirtualMemory::DestroyPageDirectory(void* page_dir, bool free_pages)
161 -> void {

Callers 2

virtual_memory_testFunction · 0.80
TEST_FFunction · 0.80

Calls 3

ErrorClass · 0.85
IsPageTableEntryValidFunction · 0.85
PageTableEntryToPhysicalFunction · 0.85

Tested by 2

virtual_memory_testFunction · 0.64
TEST_FFunction · 0.64