Page 1 of 1

Triple fault on switching page directory

Posted: Wed Jan 27, 2016 12:55 pm
by LPeter
First I've made a page directory and enabled paging. That went fine, paging works. Now I'm trying to clone directories. I've cloned the kernel directory and tried to switch to the cloned one but the system triple faults. Here's the dump:

Code: Select all

CS.mode = 32 bit
SS.mode = 32 bit
EFER   = 0x00000000
EAX=00002000  EBX=c0100000  ECX=00000300  EDX=0010a080
ESP=0010e588  EBP=0010e5d0  ESI=00106fef  EDI=00000000
OPL=0 ID vip vif ac vm RF nt of df if tf sf zf AF PF cf
SEG sltr(index|ti|rpl)     base    limit G D
CS:0008( 0001| 0|  0) 00000000 ffffffff 1 1
DS:0010( 0002| 0|  0) 00000000 ffffffff 1 1
SS:0010( 0002| 0|  0) 00000000 ffffffff 1 1
ES:0010( 0002| 0|  0) 00000000 ffffffff 1 1
FS:0010( 0002| 0|  0) 00000000 ffffffff 1 1
GS:0010( 0002| 0|  0) 00000000 ffffffff 1 1
EIP=001035fd (001035fd)
CR0=0xe0000011 CR2=0x001090c0
CR3=0x00002000 CR4=0x00000000
CR3 is page aligned (but is suspiciously a low value). Could that mean that my cloned page directory is not valid? If I just clone the directory without enabling paging and just switch straight to the cloned one it works fine.

Re: Triple fault on switching page directory

Posted: Wed Jan 27, 2016 1:36 pm
by iansjack
You set CR3 so you should know whether it's the correct value or not. Is it the physical address of your cloned table?

Re: Triple fault on switching page directory

Posted: Wed Jan 27, 2016 1:56 pm
by LPeter
iansjack wrote:You set CR3 so you should know whether it's the correct value or not. Is it the physical address of your cloned table?
This is really weird. Because I've started debugging the problem. And I don't do anything else just print out the physical address of the table. And sometimes it's 0x2000 but others it's 0x115000. I really don't change anything in the code just recompile or move some printf functions.