OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 5:58 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Strange paging issue
PostPosted: Sun Jun 18, 2017 11:47 pm 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 1584
It must be something obvious I'm missing here.
I have a screen buffer and the framebuffer mapped similarly. Or at least I thought, but sometimes the screen is not mapped. The problem appears on qemu and on bochs as well.

Here's my log:
Code:
vmm_mapbss(3E000,7FFF00000000,3CC000,2097152,800000000000001F)
vmm_mapbss(3E000,7FFF40000000,FD000000,2097152,800000000000001F)
vmm_mapbss(3E000,7FFF40200000,FD200000,2097152,800000000000001F)
vmm_mapbss(3E000,7FFF40400000,FD400000,2097152,800000000000001F)
vmm_mapbss(3E000,7FFF40600000,FD600000,2097152,800000000000001F)
OS/Z panic:  --- page fault 14 --- @20A3A1 copyarea 
[ Code]   Data    Messages    TCB    CCB    RAM    Sysinfo 
[Registers]
cs=00000023 rip=000000000020A3A1
rflags=0000000000013246 excerr=0000000D
cr2=00007FFF00000000 cr3=000000000003E000

rax=00007FFF400DE400 rbx=00007FFF400DE400
rcx=0000000000000020 rdx=00007FFF00000000
rsi=00007FFF00000000 rdi=00007FFF400DE400
r8=0000000000000600  r9=000000000000011C
r10=0000000000000C80 r11=0000000000000000
r12=0000000000000020 r13=0000000000000020
r14=0000000000000C80 r15=0000000000000C80
rbp=0000000000200000 rsp=00000000001FFFA8
...
[ Code 20A3A1: copyarea +00C8]
00C6    jnz   20A3A5h      ;copyarea +CC
00C8 -> repnz movsd   
00CA    jmp   20A3DDh      ;copyarea +104
display/fb 3D dbg> x rsi
  Code   [Data]   Messages    TCB    CCB    RAM    Sysinfo 
00007FFF00000000:  * not mapped 14 *   
...
00007FFF000001C0:  * not mapped 14 *   

  PML4 800000000006B01F 0.....WUW.  508      PDPE 800000000006C01F 0.....WUW.    0
  PDE  80000000003CC09F 0.T...WUW.    0      (slot allocated)
display/fb 3D dbg> x rdi
  Code   [Data]   Messages    TCB    CCB    RAM    Sysinfo 
00007FFF400DE400:  00 00 40 00  00 00 40 00  00 00 40 00  00 00 40 00 ..@...@...@...@.
...
00007FFF400DE5C0:  00 00 40 00  00 00 40 00  00 00 40 00  00 00 40 00 ..@...@...@...@.

  PML4 800000000006B03F 0...A.WUW.  509      PDPE 800000000006D03F 0...A.WUW.    0
  PDE  80000000FD0000BF 0.T.A.WUW.  222      (slot allocated)
display/fb 3D dbg>

The only difference I see (other than the addresses) is that the frame buffer's accessed bits are set.

Same problem shown in bochs debugger:
Code:
<bochs:3> page 0x7FFF00000000
PML4: 0x800000000006b01f XD ps         a PCD PWT U W P
PDPE: 0x800000000006c01f XD ps         a PCD PWT U W P
PDE: 0x80000000003cc09f XD PS g pat d a PCD PWT U W P
physical address not available for linear 0x00007fff00000000
<bochs:4> page 0x7FFF40000000
PML4: 0x800000000006b01f XD ps         a PCD PWT U W P
PDPE: 0x800000000006d01f XD ps         a PCD PWT U W P
PDE: 0x80000000e000009f XD PS g pat d a PCD PWT U W P
linear page 0x00007fff40000000 maps to physical page 0x0000e0000000
<bochs:5> creg
CR0=0xe0000011: PG CD NW ac wp ne ET ts em mp PE
CR2=page fault laddr=0x00000000c9ff6000
CR3=0x00000003e000
    PCD=page-level cache disable=0
    PWT=page-level write-through=0
CR4=0x000002e8: pke smap smep osxsave pcid fsgsbase smx vmx osxmmexcpt umip OSFXSR pce PGE MCE PAE pse DE tsd pvi vme
CR8: 0x0
EFER=0x00000d01: ffxsr NXE LMA LME SCE
XCR0=0x00000001: pkru hi_zmm zmm_hi256 opmask bndcfg bndregs ymm sse FPU
<bochs:6> xp 0x3cc000
[bochs]:
0x00000000003cc000 <bogus+       0>:   0x00000000
<bochs:7> xp 0x5cc000-4
[bochs]:
0x00000000005cbffc <bogus+       0>:   0x00000000
<bochs:8>

Any idea why isn't linear address 0x7FFF00000000 available? I've invalidated memory, and have CR3 reloaded. I think they both should or shouldn't work, but only one of them? How so?

Btw, physical address 0x3CC000 is reported as usable RAM in E820 map. Oddly if I boot with TianoCore, the problem disappears.


Top
 Profile  
 
 Post subject: Re: Strange paging issue
PostPosted: Sun Jun 18, 2017 11:58 pm 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8561
Location: At his keyboard!
Hi,

bzt wrote:
Btw, physical address 0x3CC000 is reported as usable RAM in E820 map. Oddly if I boot with TianoCore, the problem disappears.


If you're using 2 MiB large pages, then they have to be aligned on a 2 MiB boundary. Otherwise 0x3CC000 becomes "0x200000 with some ignored/reserved bits".


Cheers,

Brendan

_________________
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.


Top
 Profile  
 
 Post subject: Re: Strange paging issue
PostPosted: Mon Jun 19, 2017 12:23 am 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 1584
Brendan wrote:
If you're using 2 MiB large pages, then they have to be aligned on a 2 MiB boundary. Otherwise 0x3CC000 becomes "0x200000 with some ignored/reserved bits".


Cheers,

Brendan


Arrrghhhh, I knew it was something obvious! Of course you are right, thanks a lot!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 64 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group