Page 1 of 1

Problem with getting pml4 table address

Posted: Sat Oct 08, 2016 11:48 pm
by OhShift
hi guys,
I got some problems while i am trying to get the PML4 address from CR3 register.
The first one is because I dont want to use my page table so I desire to keep UEFIs, but when I try to get the physical address from cr3 by using:

Code: Select all

asm(".intel_syntax noprefix;" "mov rax, cr3;" ".att_syntax prefix;" : : "a" (PML4Addr));
It return back the virtual address, obviously virtual address cant convert to physical address without the page table, so how can I get physical address actually store in cr3?
The second problem is do I need keep tracking how many free pages there?

Thank you.

OhShift

Re: Problem with getting pml4 table address

Posted: Sun Oct 09, 2016 1:49 am
by iansjack
Reading cr3 returns the physical address.

But you shouldn't need to read cr3 to get the address - you put the value in there in the first place. Just save this address in your task information structure (which is essential when you are switching tasks anyway).