Gap in understanding paging x86_64
Posted: Mon Dec 09, 2024 8:19 pm
I have a virtual address 0xffffa00001000000, it corresponds to a physical address 0x1000000.
This virtual address corresponds to the following indexes in the tables:
PML4[320]
PDPT[0]
PD[8]
PT[0]
I am trying to check this manually with QEMU.
Check PML4
PML4 = CR3 = 0x147c000
xp /1xg 0x147c000+(320*8)
000000000147ca00: 0x0000000001534023
Check PDPT
PDPT = 0x1534000
xp /1xg 0x1534000+(0*8)
0000000001534000: 0x0000000001535023
Check PD
PD = 0x1535000
xp /1xg 0x1535000+(8*8)
0000000001535040: 0x80000000010000a3
There's something wrong at this point, it's like I immediately looked up PT instead of PD. It can be seen that the physical address of the frame corresponding to the virtual address is written here.
Even if I try to interpret it as PT, I will get garbage.
xp /1xg 0x1000000+(0*8)
0000000001000000: 0x00010102464c457f
PML4 stores PDPT, PDPT stores PD, PD stores PT, doesn't it? Why is it that when I try to browse PD, I come straight to PT?
This virtual address corresponds to the following indexes in the tables:
PML4[320]
PDPT[0]
PD[8]
PT[0]
I am trying to check this manually with QEMU.
Check PML4
PML4 = CR3 = 0x147c000
xp /1xg 0x147c000+(320*8)
000000000147ca00: 0x0000000001534023
Check PDPT
PDPT = 0x1534000
xp /1xg 0x1534000+(0*8)
0000000001534000: 0x0000000001535023
Check PD
PD = 0x1535000
xp /1xg 0x1535000+(8*8)
0000000001535040: 0x80000000010000a3
There's something wrong at this point, it's like I immediately looked up PT instead of PD. It can be seen that the physical address of the frame corresponding to the virtual address is written here.
Even if I try to interpret it as PT, I will get garbage.
xp /1xg 0x1000000+(0*8)
0000000001000000: 0x00010102464c457f
PML4 stores PDPT, PDPT stores PD, PD stores PT, doesn't it? Why is it that when I try to browse PD, I come straight to PT?