Hello.
I've run into a really strange bug.
Recently I've been working on fixing my task scheduler and stuff. I decided to try to fix my fault handler since it crashed the entire OS when one program crashes.
When I use a test program that reads from address 0 (which is unmapped), it catches it and kills the process as it should. The OS continues to run fine. I can run programs, exit them, etc.
However, when I run the test program a second time, it causes a triple fault.
My first attempt to figure out what was happening was to add "-d int" to QEMU. However, QEMU spat out a hundred or so of the following:
Quote:
check_exception old: 0xffffffff new 0xe
174874: v=0e e=0000 i=0 cpl=0 IP=0008:c0101526 pc=c0101526 SP=0010:c0155a41 CR2=00000000
Then after those it printed:
Quote:
check_exception old: 0xffffffff new 0xd
175039: v=0d e=001a i=0 cpl=0 IP=0008:000f06ac pc=000f06ac SP=0010:00000fc8 env->regs[R_EAX]=000f6206
check_exception old: 0xd new 0xd
175040: v=08 e=0000 i=0 cpl=0 IP=0008:000f06ac pc=000f06ac SP=0010:00000fc8 env->regs[R_EAX]=000f6206
check_exception old: 0x8 new 0xd
(Triple Fault)
My second attempt was to step through and compare registers in both instances.
Unfortunately, the instruction that caused the triple fault was in usermode, so this was difficult.
From what I could tell, important registers like esp, eip, cr3, etc were exactly the same.
What other methods can I use to figure this out?(Code will be posted in next post)