MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / AllocatePageTable

Function AllocatePageTable

Kernel/src/arch/x86_64/paging.cpp:240–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238 }
239
240 page_table_t AllocatePageTable(){
241 void* virt = KernelAllocate4KPages(1);
242 uint64_t phys = Memory::AllocatePhysicalMemoryBlock();
243
244 KernelMapVirtualMemory4K(phys,(uintptr_t)virt, 1);
245
246 page_table_t pTable;
247 pTable.phys = phys;
248 pTable.virt = (page_t*)virt;
249
250 for(int i = 0; i < PAGES_PER_TABLE; i++){
251 ((page_t*)virt)[i] = 0;
252 }
253
254 return pTable;
255 }
256
257 void CreatePageTable(uint16_t pdptIndex, uint16_t pageDirIndex, address_space_t* addressSpace){
258 page_table_t pTable = AllocatePageTable();

Callers 1

CreatePageTableFunction · 0.85

Calls 3

KernelAllocate4KPagesFunction · 0.85
KernelMapVirtualMemory4KFunction · 0.85

Tested by

no test coverage detected