[SOLVED] Problem using task gate as double fault handler
Posted: Sat Jul 25, 2009 12:03 pm
Hi, I am trying to create a double fault handler in order to catch stack faults and hopefully show useful information.
To do so, I created a TSS and added it to the GDT. (base=Address of TSS, limit=sizeof(TSS), access=0xE9, gran=0xCF)
Then, I set in the new TSS eip, cr3, cs, ds, es, fs, gs, ss, esp and eflags of the handler.
To set the task gate into the IDT, I am using index=8, base=0, selector=0x30, flags=0x85.
Now I am trying some tests to check if it works:
Both work fine in qemu, bochs, virtual box and vmware.
However, when I try to do a double fault (ie. by changing esp to a unmapped page and then trying to push/pop something), the handler does not work
In qemu it crashes.
In bochs and vmware works.
In vbox doesn't crash but the handler isn't executed.
Why whould this happen? Am I missing some flag?
Thanks,
Gzaloprgm
To do so, I created a TSS and added it to the GDT. (base=Address of TSS, limit=sizeof(TSS), access=0xE9, gran=0xCF)
Then, I set in the new TSS eip, cr3, cs, ds, es, fs, gs, ss, esp and eflags of the handler.
To set the task gate into the IDT, I am using index=8, base=0, selector=0x30, flags=0x85.
Now I am trying some tests to check if it works:
Code: Select all
asm volatile("int $8");
/
asm volatile("jmp $(0x30),$0");
However, when I try to do a double fault (ie. by changing esp to a unmapped page and then trying to push/pop something), the handler does not work
In qemu it crashes.
In bochs and vmware works.
In vbox doesn't crash but the handler isn't executed.
Why whould this happen? Am I missing some flag?
Thanks,
Gzaloprgm