double fault works in bochs but not vmware
Posted: Thu Dec 29, 2005 10:58 pm
so I have been setting up my double fault handler, and it appears to work fine in bochs, but not vmware
anyway, here some of my code:
I then set the GDT entry at GDT::double_fault_tss is set to this TSS entry. I also set my IDT entry for exception #8 to be a task gate, present and ring0 with a segment of GDT::double_fault_tss.
It appears to work perfectly in bochs, when i tell my OS to trip a double fault, it goes to my handler. But in vmware, it simply resets (I assume I got a triple fault).
My code to trigger a double fault is as follows:
proxy
anyway, here some of my code:
Code: Select all
TSS g_DoubleFaultTSS;
uint8_t g_DoubleFaultStack[1024];
/*---snip---*/
std::memset(&g_DoubleFaultTSS, 0, sizeof(TSS));
g_DoubleFaultTSS.esp0 = reinterpret_cast<uint32_t>(g_DoubleFaultStack + sizeof(g_DoubleFaultStack));
g_DoubleFaultTSS.ss0 = GDT::kernel_ds;
g_DoubleFaultTSS.eip = reinterpret_cast<uint32_t>(&_exception_08);
g_DoubleFaultTSS.ds = GDT::kernel_ds;
g_DoubleFaultTSS.es = GDT::kernel_ds;
g_DoubleFaultTSS.fs = GDT::kernel_ds;
g_DoubleFaultTSS.gs = GDT::kernel_ds;
g_DoubleFaultTSS.ss = GDT::kernel_ds;
g_DoubleFaultTSS.cs = GDT::kernel_cs;
g_DoubleFaultTSS.cr3 = reinterpret_cast<uint32_t>(kernel_process->pageDirectory());
It appears to work perfectly in bochs, when i tell my OS to trip a double fault, it goes to my handler. But in vmware, it simply resets (I assume I got a triple fault).
My code to trigger a double fault is as follows:
Code: Select all
__asm__ __volatile__ ("mov $0x12345678, %esp"); /* trash esp */
__asm__ __volatile__ ("push 0xdeadbeef"); /* push some value, will page fault and subsequently page fault in the page fault handler */