Hi,
I trying to implement paging, I have set up one pde and one 1024 pte, then enabled paging, qemu showed me that everything works (identity mapping + higher half). However, whenever I want to jump to the higher half, by calling a function which is at a 0xC....... address qemu terminates and shows me that a triple fault occured. The content of the cr2 doesn't make any sense to me .
paging: get triple faults
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: paging: get triple faults
Maybe it does to us - care to show us the dump?kiwipresse wrote:The content of the cr2 doesn't make any sense to me .
-
- Member
- Posts: 25
- Joined: Sun Nov 04, 2007 7:41 am
Re: paging: get triple faults
Oh yes, I'm sorry
I suppose the reason why there is a strange value in cr2 is because I didn't set up any exception handlers yet. The content from EIP is exactly the address from the function which I try to call. qemu mem showed me that the first 4mb is mapped correctly to the higher half. I don't know where I made the mistake
Code: Select all
qemu: fatal: triple fault
EAX=e0000011 EBX=0002e0b0 ECX=00000001 EDX=00106ffc
ESI=00054cd8 EDI=00000000 EBP=00101034 ESP=00101008
EIP=c01023e0 EFL=00000002 [-------] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =0010 00000000 ffffffff 00cf9300
CS =0008 00000000 ffffffff 00cf9a00
SS =0010 00000000 ffffffff 00cf9300
DS =0010 00000000 ffffffff 00cf9300
FS =0010 00000000 ffffffff 00cf9300
GS =0010 00000000 ffffffff 00cf9300
LDT=0000 00000000 0000ffff 00008000
TR =0000 00000000 0000ffff 00008000
GDT= 00009040 00000027
IDT= 00000000 000003ff
CR0=e0000011 CR2=e0000011 CR3=00102000 CR4=00000000
CCS=000003ff CCD=e0000011 CCO=LOGICL
FCW=037f FSW=0000 [ST=0] FTW=00 MXCSR=00001f80
FPR0=0000000000000000 0000 FPR1=0000000000000000 0000
FPR2=0000000000000000 0000 FPR3=0000000000000000 0000
FPR4=0000000000000000 0000 FPR5=0000000000000000 0000
FPR6=0000000000000000 0000 FPR7=0000000000000000 0000
XMM00=00000000000000000000000000000000 XMM01=00000000000000000000000000000000
XMM02=00000000000000000000000000000000 XMM03=00000000000000000000000000000000
XMM04=00000000000000000000000000000000 XMM05=00000000000000000000000000000000
XMM06=00000000000000000000000000000000 XMM07=00000000000000000000000000000000
Re: paging: get triple faults
Your CR2 is what CR0 is supposed to /needs to be. Are you sure you didn't accidentally write to CR2 instead of writing to CR0 as that is what it looks like. Or do you load CR0 with the memory location of 0xe0000011 instead of the dword 0xe0000011?
Website: https://joscor.com
-
- Member
- Posts: 25
- Joined: Sun Nov 04, 2007 7:41 am
Re: paging: get triple faults
Here is what I do at the end, in dummy code:
disassembled...
I don't know why cr0 and cr2 are actually the same... nor whether this is important
Code: Select all
/* pde is a pointer */
set_cr3(pde);
set_cr0(get_cr0() | 0x80000000);
call main;
Code: Select all
1010de: 8b 45 f4 mov -0xc(%ebp),%eax
1010e1: 0f 22 d8 mov %eax,%cr3
1010e4: 0f 20 c0 mov %cr0,%eax
1010e7: 89 45 f8 mov %eax,-0x8(%ebp)
1010ea: 8b 45 f8 mov -0x8(%ebp),%eax
1010ed: 0d 00 00 00 80 or $0x80000000,%eax
1010f2: 89 45 fc mov %eax,-0x4(%ebp)
1010f5: 8b 45 fc mov -0x4(%ebp),%eax
1010f8: 0f 22 c0 mov %eax,%cr0
1010fb: e8 e0 12 00 c0 call c01023e0 <main>
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: paging: get triple faults
why is your main function (1023e0) located inside your page directory (102000-102fff)