People always ask me why their virtual address is not pointing to the right physical address. Almost every time is the page table get wrong. But there are few possibilities, such as PD, CR address and etc.. You can use these step to find out.
1) First, set the physical point and run until the breakpoint is hit. Make sure your protected mode and paging is on. Also, don’t use virtual breakpoint because your page table is in trouble.
2) In peter-bochs, there is a “address translate” function to show you how the cpu translates your virtual/linear address to physical address. Just type in your address and select “linear”, click “go” button, see below:
As you can see, you get the PD no. and PT no. Which is the offset of you page directory and page table.
3) Go the “Paging” tab, it dump out the whole page dir and page table. LHS is page directory, if you see the bytes are fake in there, it is either your CR3 (page directory base register) is pointing to an address which your page directory is not exist in there. OR you build your page directory wrongly. If your page directory looks ok, click on the entry (remember click the correct PD no.), peter-bochs will dump out the corresponding page tables on the RHS, finally you can see which physical address is pointing to. If the physical address is wrong, then you know your PTE (page table entry) is wrong.
read count : 303