From: Ben Pfaff Date: Sat, 9 Sep 2006 16:53:56 +0000 (+0000) Subject: Fix issue reported by Godmar Back: X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2b4b1acd2d80945294b8786396251857005c0a81;p=pintos-anon Fix issue reported by Godmar Back: I may have found a problem with the triple fault patch, though I don't know how to solve it. If you add a *(int *)0=42 right after paging_init(), but before intr_init(), gdb will just hang: ... where it hangs while Pintos prints: Triple fault: stopping for gdb Triple fault: stopping for gdb Triple fault: stopping for gdb Triple fault: stopping for gdb Triple fault: stopping for gdb Triple fault: stopping for gdb Triple fault: stopping for gdb Triple fault: stopping for gdb Triple fault: stopping for gdb Triple fault: stopping for gdb Triple fault: stopping for gdb etc. It stops properly if I don't next-step (that is, if I just let it run.) --- diff --git a/src/misc/bochs-2.2.6-triple-fault.patch b/src/misc/bochs-2.2.6-triple-fault.patch index 06da80e..f6d0871 100644 --- a/src/misc/bochs-2.2.6-triple-fault.patch +++ b/src/misc/bochs-2.2.6-triple-fault.patch @@ -1,30 +1,57 @@ ---- bochs-2.2.6.orig/cpu/exception.cc 2006-01-25 14:20:00.000000000 -0800 -+++ bochs-2.2.6/cpu/exception.cc 2006-04-08 13:01:18.000000000 -0700 -@@ -841,6 +841,12 @@ void BX_CPU_C::exception(unsigned vector +diff -u bochs-2.2.6.orig/cpu/exception.cc bochs-2.2.6/cpu/exception.cc +--- bochs-2.2.6.orig/cpu/exception.cc ++++ bochs-2.2.6/cpu/exception.cc +@@ -841,6 +841,13 @@ void BX_CPU_C::exception(unsigned vector BX_CPU_THIS_PTR errorno++; if (BX_CPU_THIS_PTR errorno >= 3) { +#if BX_GDBSTUB + if (bx_dbg.gdbstub_enabled) { + fprintf(stderr, "Triple fault: stopping for gdb\n"); ++ BX_CPU_THIS_PTR ispanic = 1; + longjmp(BX_CPU_THIS_PTR jmp_buf_env, 1); + } +#endif #if BX_RESET_ON_TRIPLE_FAULT BX_ERROR(("exception(): 3rd (%d) exception with no resolution, shutdown status is %02xh, resetting", vector, DEV_cmos_get_reg(0x0f))); debug(BX_CPU_THIS_PTR prev_eip); -@@ -860,6 +866,12 @@ void BX_CPU_C::exception(unsigned vector +@@ -860,6 +867,13 @@ void BX_CPU_C::exception(unsigned vector /* if 1st was a double fault (software INT?), then shutdown */ if ( (BX_CPU_THIS_PTR errorno==2) && (BX_CPU_THIS_PTR curr_exception[0]==BX_ET_DOUBLE_FAULT) ) { +#if BX_GDBSTUB + if (bx_dbg.gdbstub_enabled) { + fprintf(stderr, "Triple fault: stopping for gdb\n"); ++ BX_CPU_THIS_PTR ispanic = 1; + longjmp(BX_CPU_THIS_PTR jmp_buf_env, 1); + } +#endif #if BX_RESET_ON_TRIPLE_FAULT BX_INFO(("exception(): triple fault encountered, shutdown status is %02xh, resetting", DEV_cmos_get_reg(0x0f))); debug(BX_CPU_THIS_PTR prev_eip); - -Diff finished at Sat Apr 8 13:07:40 +diff -u bochs-2.2.6.orig/gdbstub.cc bochs-2.2.6/gdbstub.cc +--- bochs-2.2.6.orig/gdbstub.cc ++++ bochs-2.2.6/gdbstub.cc +@@ -466,19 +466,19 @@ static void debug_loop(void) + + BX_INFO (("stepping")); + stub_trace_flag = 1; ++ bx_cpu.ispanic = 0; + bx_cpu.cpu_loop(-1); + DEV_vga_refresh(); + stub_trace_flag = 0; + BX_INFO (("stopped with %x", last_stop_reason)); + buf[0] = 'S'; +- if (last_stop_reason == GDBSTUB_EXECUTION_BREAKPOINT || +- last_stop_reason == GDBSTUB_TRACE) ++ if (last_stop_reason == GDBSTUB_TRACE && !bx_cpu.ispanic) + { + write_signal(&buf[1], SIGTRAP); + } + else + { +- write_signal(&buf[1], SIGTRAP); ++ write_signal(&buf[1], SIGSEGV); + } + put_reply(buf); + break;