Long mode page tables not showing up in Bochs debugger

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
milliburn
Posts: 5
Joined: Mon Jul 01, 2013 10:13 am

Long mode page tables not showing up in Bochs debugger

Post by milliburn »

Hello,

I've come upon a curious issue with Bochs. Under question is a long-mode kernel with the following initial page structure:

Code: Select all

0x0000000000000000 identity maps physical 0x0..0x200000
0xFFFFFFFF80000000 (i.e. -2GB) maps physical 0x0..0x200000
0xFFFFFFFFC0000000 (i.e. -1GB) maps dynamically allocated pages for the kernel stack
0xFFFFFF8000000000 (i.e. 510th PML4) maps unto itself
The above mapping is known to work as the kernel is functional. However, in the bochs debugger console, not all mappings show up:

Code: Select all

<bochs:1> info tab
cr3: 0x000000101000
0x00000000-0x001fffff -> 0x000000000000-0x0000001fffff
<bochs:2> page 0xFFFFFFFF80000000
PML4: 0x0000000000102003    ps         a pcd pwt S W P
PDPE: 0x0000000000103003    ps         a pcd pwt S W P
 PDE: 0x0000000000105003    ps         a pcd pwt S W P
 PTE: 0x0000000000000003       g pat d a pcd pwt S W P
linear page 0xffffffff80000000 maps to physical page 0x000000000000
Later the kernel removes the identity map, at which point "info tab" will yield no translations whatsoever. In essence then, Bochs in long mode is not reporting all page tables even though the mappings are in effect.

A search of the Bochs trackers and mailing lists turned up nothing. Is this a known issue, or am I missing something?

(running Bochs 2.6.2 compiled from the Arch build system w/ custom flags)
PearOs
Member
Member
Posts: 194
Joined: Mon Apr 08, 2013 3:03 pm
Location: Usually at my keyboard!

Re: Long mode page tables not showing up in Bochs debugger

Post by PearOs »

I could be wrong but I don't "100%" remember the paging structure but don't you have to set a count of how many pages there are for the CPU? Cause I know with the GDT you have to set that.

Just an idea,

Matt
stlw
Member
Member
Posts: 357
Joined: Fri Apr 04, 2008 6:43 am
Contact:

Re: Long mode page tables not showing up in Bochs debugger

Post by stlw »

PearOs wrote:I could be wrong but I don't "100%" remember the paging structure but don't you have to set a count of how many pages there are for the CPU? Cause I know with the GDT you have to set that.Matt
There is nothing like that in x86.

Bochs has known issue that it doesn't show any virtual->physical mappings above 4GB in 'info tab' command.
The complete list of 64-bit mappings could be huge and just parsing all of them by going through page tables could take very long time.
There is Bochs patch sitting in the SourceForge patches tracker which is supposed to address that:

[497] Page Table view shows only low 32-bits linear address

'page' command supposed to work for any page existing - it just walks the tables for single virtual address.

Stanislav
milliburn
Posts: 5
Joined: Mon Jul 01, 2013 10:13 am

Re: Long mode page tables not showing up in Bochs debugger

Post by milliburn »

stlw wrote:Bochs has known issue that it doesn't show any virtual->physical mappings above 4GB in 'info tab' command.
The complete list of 64-bit mappings could be huge and just parsing all of them by going through page tables could take very long time.
There is Bochs patch sitting in the SourceForge patches tracker which is supposed to address that:
Makes sense. Cheers for the quick reply.
Post Reply