| 28 | page_dir_t kernelHeapDir __attribute__((aligned(4096))); |
| 29 | page_t kernelHeapDirTables[TABLES_PER_DIR][PAGES_PER_TABLE] __attribute__((aligned(4096))); |
| 30 | page_dir_t ioDirs[4] __attribute__((aligned(4096))); |
| 31 | |
| 32 | uint64_t VirtualToPhysicalAddress(uint64_t addr) { |
| 33 | uint64_t address = 0; |
| 34 | |
| 35 | uint32_t pml4Index = PML4_GET_INDEX(addr); |
| 36 | uint32_t pageDirIndex = PAGE_DIR_GET_INDEX(addr); |
| 37 | uint32_t pageTableIndex = PAGE_TABLE_GET_INDEX(addr); |
| 38 | |
| 39 | if(pml4Index < 511){ // From Process Address Space |
| 40 | |
| 41 | } else { // From Kernel Address Space |
| 42 | if(kernelHeapDir[pageDirIndex] & 0x80){ |
| 43 | address = (GetPageFrame(kernelHeapDir[pageDirIndex])) << 12; |
| 44 | } else { |
| 45 | address = (GetPageFrame(kernelHeapDirTables[pageDirIndex][pageTableIndex])) << 12; |
| 46 | } |
| 47 | } |
| 48 | return address; |
| 49 | } |
| 50 | |
| 51 | uint64_t VirtualToPhysicalAddress(uint64_t addr, address_space_t* addressSpace) { |
| 52 | uint64_t address = 0; |
no test coverage detected