PageDirectoryPointerTable, instead of &PageDirectoryPointerTable; I suppose you knew the difference and just merely a mistake.requimrar wrote:bluemoon wrote:Hint #1: &PageDirectoryPointerTableCode: Select all
PML4T[0] = (uint64_t)&PageDirectoryPointerTable | 3; // Present, R/W PageDirectoryPointerTable[0] = (uint64_t)&PageDirectory | 3; // Present, R/W PageDirectory[0] = (uint64_t)&PageTable | 3; // Present, R/W
Hint #2: This whole thing will not work if logical(as view by linker) address(PageDirectoryPointerTable) != physical address
1. What am I supposed to use then?
A simplified way is:requimrar wrote:2. ...? How then, would I ensure that the physical address matches the logical address?
Code: Select all
PML4T[0] = physical_address( PDPT ) | 3;
PDPT[0] = physical_address( PDT ) | 3;
...
#define physical_address(p) ( (uint64_t)(p) - KERNEL_VADDR + KERNEL_PADDR )
KERNEL_VADDR = your kernel logical address as specified in linker script (e.g. 0xFFFFFFFF80100000)
KERNEL_PADDR = the physical address of the point of KERNEL_VADDR (e.g. 0x00100000 mark)
PS. I do this step in assembly.