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 */