Page 1 of 1

Long mode page tables not showing up in Bochs debugger

Posted: Mon Jan 20, 2014 4:23 pm
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)

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

Posted: Mon Jan 20, 2014 8:12 pm
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

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

Posted: Tue Jan 21, 2014 12:52 am
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

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

Posted: Tue Jan 21, 2014 3:33 pm
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.