Strange page fault
Posted: Thu Dec 16, 2010 3:14 pm
Hello everybody,
We (me and a friend) are trying to setup virtual memory into our kernel. We already have a VESA drivers which provides us a framebuffer to manage the screen. The VESA configuration functions give us the address 0xe0000000 to write to the screen so we mapped it to 0xe0000000 in linear adresses.
If I try to access this address with a simple pointer, like this :
it writes white pixels on the screen. But if I use a memcpy to copy come datas here, it does a page fault. Besides, before our work, we already had a simple paging system (just a identity mapping) where we mapped VESA memory like this and worked well.
Bochs just tell me that the Page Table Entry is not present, but I don't understand why, because I write in the VESA buffer before the memcpy ...
Here is the Bochs trace,
Here I write with the pointer, everything is okay :
Just after I use a memcpy and ... :
So if you have any idea on what I miss ... Thank you ^^"
Edit: I correct the mistake ~~
We (me and a friend) are trying to setup virtual memory into our kernel. We already have a VESA drivers which provides us a framebuffer to manage the screen. The VESA configuration functions give us the address 0xe0000000 to write to the screen so we mapped it to 0xe0000000 in linear adresses.
If I try to access this address with a simple pointer, like this :
Code: Select all
char *framebuffer = (char*)0xe0000000;
for (int i = 0; i < 100000; i++) {
*framebuffer++ = 0xFF;
}
Bochs just tell me that the Page Table Entry is not present, but I don't understand why, because I write in the VESA buffer before the memcpy ...
Here is the Bochs trace,
Here I write with the pointer, everything is okay :
Code: Select all
00199747348d[CPU0 ] page walk for address 0x00000000c0540a38
00199747360d[CPU0 ] page walk for address 0x00000000e0000000
00199763744d[CPU0 ] page walk for address 0x00000000e0001000
00199780128d[CPU0 ] page walk for address 0x00000000e0002000
00199796512d[CPU0 ] page walk for address 0x00000000e0003000
00199812896d[CPU0 ] page walk for address 0x00000000e0004000
00199829280d[CPU0 ] page walk for address 0x00000000e0005000
00199845664d[CPU0 ] page walk for address 0x00000000e0006000
Code: Select all
00201158883d[CPU0 ] page walk for address 0x00000000e0000000
00201158883d[CPU0 ] PTE: entry not present
00201158883d[CPU0 ] page fault for address 00000000e0000000 @ 00000000c011f8ce
00201158883d[CPU0 ] exception(0x0e): error_code=0002
00201158883d[CPU0 ] interrupt(): vector = 0e, TYPE = 3, EXT = 1
00201158883d[CPU0 ] page walk for address 0x00000000c05518f0
00201158883e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x0e)
00201158883d[CPU0 ] exception(0x0d): error_code=0072
00201158883d[CPU0 ] exception(0x08): error_code=0000
00201158883d[CPU0 ] interrupt(): vector = 08, TYPE = 3, EXT = 1
00201158883e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x08)
00201158883d[CPU0 ] exception(0x0d): error_code=0042
00201158883i[CPU0 ] CPU is in protected mode (active)
00201158883i[CPU0 ] CS.d_b = 32 bit
00201158883i[CPU0 ] SS.d_b = 32 bit
00201158883i[CPU0 ] EFER = 0x00000000
00201158883i[CPU0 ] | RAX=00000000e0000000 RBX=0000000000000000
00201158883i[CPU0 ] | RCX=0000000000003c00 RDX=00000000c0552310
00201158883i[CPU0 ] | RSP=00000000c05409bc RBP=00000000c05409d8
00201158883i[CPU0 ] | RSI=00000000c0552310 RDI=00000000e0000000
00201158883i[CPU0 ] | R8=0000000000000000 R9=0000000000000000
00201158883i[CPU0 ] | R10=0000000000000000 R11=0000000000000000
00201158883i[CPU0 ] | R12=0000000000000000 R13=0000000000000000
00201158883i[CPU0 ] | R14=0000000000000000 R15=0000000000000000
00201158883i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf sf ZF af PF cf
00201158883i[CPU0 ] | SEG selector base limit G D
00201158883i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
00201158883i[CPU0 ] | CS:0010( 0002| 0| 0) 00000000 ffffffff 1 1
00201158883i[CPU0 ] | DS:0018( 0003| 0| 0) 00000000 ffffffff 1 1
00201158883i[CPU0 ] | SS:0018( 0003| 0| 0) 00000000 ffffffff 1 1
00201158883i[CPU0 ] | ES:0018( 0003| 0| 0) 00000000 ffffffff 1 1
00201158883i[CPU0 ] | FS:0000( 0000| 0| 0) 00000000 00000000 0 0
00201158883i[CPU0 ] | GS:0000( 0000| 0| 0) 00000000 00000000 0 0
00201158883i[CPU0 ] | MSR_FS_BASE:0000000000000000
00201158883i[CPU0 ] | MSR_GS_BASE:0000000000000000
00201158883i[CPU0 ] | RIP=00000000c011f8cc (00000000c011f8cc)
00201158883i[CPU0 ] | CR0=0xe0000011 CR2=0x00000000e0000000
00201158883i[CPU0 ] | CR3=0x00101000 CR4=0x00000000
(0).[201158883] [0x000000000011f8cc] 0010:00000000c011f8cc (unk. ctxt): rep movsd dword ptr es:[edi], dword ptr ds:[esi] ; f3a5
00201158883e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
Edit: I correct the mistake ~~