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

Method DestroyPageDirectory

src/memory/virtual_memory.cpp:160–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158}
159
160auto VirtualMemory::DestroyPageDirectory(void* page_dir, bool free_pages)
161 -> void {
162 if (page_dir == nullptr) {
163 return;
164 }
165
166 // 递归释放所有层级的页表
167 RecursiveFreePageTable(reinterpret_cast<uint64_t*>(page_dir),
168 cpu_io::virtual_memory::kPageTableLevels - 1,
169 free_pages);
170
171 // 释放根页表目录本身
172 aligned_free(page_dir);
173
174 klog::Debug("Destroyed page directory at address: {:#x}",
175 static_cast<uint64_t>(reinterpret_cast<uintptr_t>(page_dir)));
176}
177
178auto VirtualMemory::ClonePageDirectory(void* src_page_dir, bool copy_mappings)
179 -> Expected<void*> {

Callers 4

CloneMethod · 0.80
~TaskControlBlockMethod · 0.80
virtual_memory_testFunction · 0.80
TEST_FFunction · 0.80

Calls 2

DebugFunction · 0.85
aligned_freeFunction · 0.70

Tested by 2

virtual_memory_testFunction · 0.64
TEST_FFunction · 0.64