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 // cannot use current_cpu() here because this must run on a thread stack,
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 CPU=%u\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,
50 cxx::int_value<Cpu_number>(current_cpu()));
54 puts ("Return reboots, \"k\" tries to enter the L4 kernel debugger...");
56 while ((c = Kconsole::console()->getchar(false)) == -1)
59 if (c == 'k' || c == 'K')
64 // built a nice trap state the jdb can work with
82 ts.flags(tss->_eflags);
88 : "a"(&ts), "m"(nested_trap_handler)
89 : "ecx", "edx", "memory");
94 puts ("Return reboots");
95 while ((Kconsole::console()->getchar(false)) == -1)
99 puts ("\033[1mRebooting...\033[0m");