6 static void handle_double_fault (void) asm ("thread_handle_double_fault");
9 static bool may_enter_jdb;
17 #include "kernel_console.h"
18 #include "processor.h"
20 #include "trap_state.h"
25 bool Thread::may_enter_jdb = false;
29 Thread::handle_double_fault (void)
31 // XXX: will not work, because currnt_cpu() must run on a thread stack, not
33 volatile Tss *tss = Cpu::boot_cpu()->get_tss();
39 "\033[1;31mDOUBLE FAULT!\033[m\n"
40 "EAX=%08x ESI=%08x DS=%04x \n"
41 "EBX=%08x EDI=%08x ES=%04x\n"
42 "ECX=%08x EBP=%08x GS=%04x\n"
43 "EDX=%08x ESP=%08x SS=%04x ESP0=%08lx\n"
44 "EFL=%08x EIP=%08x CS=%04x\n",
45 tss->_eax, tss->_esi, tss->_ds & 0xffff,
46 tss->_ebx, tss->_edi, tss->_es & 0xffff,
47 tss->_ecx, tss->_ebp, tss->_gs & 0xffff,
48 tss->_edx, tss->_esp, tss->_ss & 0xffff, tss->_esp0,
49 tss->_eflags, tss->_eip, tss->_cs & 0xffff);
53 puts ("Return reboots, \"k\" tries to enter the L4 kernel debugger...");
55 while ((c=Kconsole::console()->getchar(false)) == -1)
58 if (c == 'k' || c == 'K')
63 // built a nice trap state the jdb can work with
81 ts.flags(tss->_eflags);
87 : "a"(&ts), "m"(nested_trap_handler)
88 : "ecx", "edx", "memory");
93 puts ("Return reboots");
94 while ((Kconsole::console()->getchar(false)) == -1)
98 puts ("\033[1mRebooting...\033[0m");