Page fault problem
Posted: Sat Aug 02, 2008 12:21 am
Hi, I got a very strange problem when i enable paging.
there is some information i got from bochs:
00068859702i[CPU0 ] EFER = 0x00000000
00068859702i[CPU0 ] | RAX=0000000080000011 RBX=0000000000100000
00068859702i[CPU0 ] | RCX=00000000000b8efe RDX=00000000000003d5
00068859702i[CPU0 ] | RSP=0000000000067e38 RBP=0000000000067e38
00068859702i[CPU0 ] | RSI=0000000000000000 RDI=0000000000000001
00068859702i[CPU0 ] | R8=0000000000000000 R9=0000000000000000
00068859702i[CPU0 ] | R10=0000000000000000 R11=0000000000000000
00068859702i[CPU0 ] | R12=0000000000000000 R13=0000000000000000
00068859702i[CPU0 ] | R14=0000000000000000 R15=0000000000000000
00068859702i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf SF zf af PF cf
00068859702i[CPU0 ] | SEG selector base limit G D
00068859702i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
00068859702i[CPU0 ] | CS:0008( 0001| 0| 0) 00000000 000fffff 1 1
00068859702i[CPU0 ] | DS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00068859702i[CPU0 ] | SS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00068859702i[CPU0 ] | ES:0010( 0002| 0| 0) 00000000 000fffff 1 1
00068859702i[CPU0 ] | FS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00068859702i[CPU0 ] | GS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00068859702i[CPU0 ] | MSR_FS_BASE:0000000000000000
00068859702i[CPU0 ] | MSR_GS_BASE:0000000000000000
00068859702i[CPU0 ] | RIP=00000000001042ee (00000000001042ee)
00068859702i[CPU0 ] | CR0=0x80000011 CR1=0x0 CR2=0x0000000080000011
00068859702i[CPU0 ] | CR3=0x00200000 CR4=0x00000000
00068859702i[CPU0 ] >> add byte ptr ds:[eax], al : 0000
00068859702e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
it seems the bochs did not find the page fault handler.
but before this exception happend, i use the follow code to call my page fault handler:
and this is work. i can see my page fault handler is executed.
but when i enable the paging , how could bochs can not find the correct handler?
here is the code i enable the paging:
please give me some tips.
there is some information i got from bochs:
00068859702i[CPU0 ] EFER = 0x00000000
00068859702i[CPU0 ] | RAX=0000000080000011 RBX=0000000000100000
00068859702i[CPU0 ] | RCX=00000000000b8efe RDX=00000000000003d5
00068859702i[CPU0 ] | RSP=0000000000067e38 RBP=0000000000067e38
00068859702i[CPU0 ] | RSI=0000000000000000 RDI=0000000000000001
00068859702i[CPU0 ] | R8=0000000000000000 R9=0000000000000000
00068859702i[CPU0 ] | R10=0000000000000000 R11=0000000000000000
00068859702i[CPU0 ] | R12=0000000000000000 R13=0000000000000000
00068859702i[CPU0 ] | R14=0000000000000000 R15=0000000000000000
00068859702i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf SF zf af PF cf
00068859702i[CPU0 ] | SEG selector base limit G D
00068859702i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
00068859702i[CPU0 ] | CS:0008( 0001| 0| 0) 00000000 000fffff 1 1
00068859702i[CPU0 ] | DS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00068859702i[CPU0 ] | SS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00068859702i[CPU0 ] | ES:0010( 0002| 0| 0) 00000000 000fffff 1 1
00068859702i[CPU0 ] | FS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00068859702i[CPU0 ] | GS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00068859702i[CPU0 ] | MSR_FS_BASE:0000000000000000
00068859702i[CPU0 ] | MSR_GS_BASE:0000000000000000
00068859702i[CPU0 ] | RIP=00000000001042ee (00000000001042ee)
00068859702i[CPU0 ] | CR0=0x80000011 CR1=0x0 CR2=0x0000000080000011
00068859702i[CPU0 ] | CR3=0x00200000 CR4=0x00000000
00068859702i[CPU0 ] >> add byte ptr ds:[eax], al : 0000
00068859702e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
it seems the bochs did not find the page fault handler.
but before this exception happend, i use the follow code to call my page fault handler:
Code: Select all
asm volatile ("int $0xe");but when i enable the paging , how could bochs can not find the correct handler?
here is the code i enable the paging:
Code: Select all
asm volatile("movl %0, %%cr3\n\t"
"movl %%cr0, %%eax\n\t"
"or $0x80000000, %%eax\n\t"
"movl %%eax, %%cr0\n\t"
::"r"(pageDirectory));