diff options
Diffstat (limited to 'pintos-progos/misc/0002-bochs-2.3.7-triple-fault.patch')
| -rw-r--r-- | pintos-progos/misc/0002-bochs-2.3.7-triple-fault.patch | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/pintos-progos/misc/0002-bochs-2.3.7-triple-fault.patch b/pintos-progos/misc/0002-bochs-2.3.7-triple-fault.patch new file mode 100644 index 0000000..c8698bd --- /dev/null +++ b/pintos-progos/misc/0002-bochs-2.3.7-triple-fault.patch | |||
| @@ -0,0 +1,87 @@ | |||
| 1 | From 356b7e781c815c70c992d58360caa42f1776d06b Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Alex Busenius <s9albuse@stud.uni-saarland.de> | ||
| 3 | Date: Mon, 27 Apr 2009 17:09:27 +0200 | ||
| 4 | Subject: bochs-2.3.7 triple fault | ||
| 5 | |||
| 6 | --- | ||
| 7 | cpu/cpu.h | 4 ++++ | ||
| 8 | cpu/exception.cc | 7 +++++++ | ||
| 9 | gdbstub.cc | 11 ++++++++--- | ||
| 10 | 3 files changed, 19 insertions(+), 3 deletions(-) | ||
| 11 | |||
| 12 | diff --git a/cpu/cpu.h b/cpu/cpu.h | ||
| 13 | index 7c7b11b..c47133a 100644 | ||
| 14 | --- a/cpu/cpu.h | ||
| 15 | +++ b/cpu/cpu.h | ||
| 16 | @@ -903,6 +903,10 @@ public: // for now... | ||
| 17 | #endif | ||
| 18 | Bit8u trace; | ||
| 19 | |||
| 20 | +#if BX_GDBSTUB | ||
| 21 | + Bit8u ispanic; | ||
| 22 | +#endif | ||
| 23 | + | ||
| 24 | // for paging | ||
| 25 | struct { | ||
| 26 | bx_TLB_entry entry[BX_TLB_SIZE] BX_CPP_AlignN(16); | ||
| 27 | diff --git a/cpu/exception.cc b/cpu/exception.cc | ||
| 28 | index c3e3777..fb3abfc 100644 | ||
| 29 | --- a/cpu/exception.cc | ||
| 30 | +++ b/cpu/exception.cc | ||
| 31 | @@ -856,6 +856,13 @@ void BX_CPU_C::exception(unsigned vector, Bit16u error_code, bx_bool trap) | ||
| 32 | // trap into debugger (similar as done when PANIC occured) | ||
| 33 | bx_debug_break(); | ||
| 34 | #endif | ||
| 35 | +#if BX_GDBSTUB | ||
| 36 | + if (bx_dbg.gdbstub_enabled) { | ||
| 37 | + fprintf(stderr, "Triple fault: stopping for gdb\n"); | ||
| 38 | + BX_CPU_THIS_PTR ispanic = 1; | ||
| 39 | + longjmp(BX_CPU_THIS_PTR jmp_buf_env, 1); | ||
| 40 | + } | ||
| 41 | +#endif | ||
| 42 | if (SIM->get_param_bool(BXPN_RESET_ON_TRIPLE_FAULT)->get()) { | ||
| 43 | BX_ERROR(("exception(): 3rd (%d) exception with no resolution, shutdown status is %02xh, resetting", vector, DEV_cmos_get_reg(0x0f))); | ||
| 44 | bx_pc_system.Reset(BX_RESET_SOFTWARE); | ||
| 45 | diff --git a/gdbstub.cc b/gdbstub.cc | ||
| 46 | index f58f866..bc5ed61 100644 | ||
| 47 | --- a/gdbstub.cc | ||
| 48 | +++ b/gdbstub.cc | ||
| 49 | @@ -471,7 +471,12 @@ static void debug_loop(void) | ||
| 50 | } | ||
| 51 | |||
| 52 | stub_trace_flag = 0; | ||
| 53 | + bx_cpu.ispanic = 0; | ||
| 54 | bx_cpu.cpu_loop(0); | ||
| 55 | + if (bx_cpu.ispanic) | ||
| 56 | + { | ||
| 57 | + last_stop_reason = GDBSTUB_EXECUTION_BREAKPOINT; | ||
| 58 | + } | ||
| 59 | |||
| 60 | DEV_vga_refresh(); | ||
| 61 | |||
| 62 | @@ -502,19 +507,19 @@ static void debug_loop(void) | ||
| 63 | |||
| 64 | BX_INFO(("stepping")); | ||
| 65 | stub_trace_flag = 1; | ||
| 66 | + bx_cpu.ispanic = 0; | ||
| 67 | bx_cpu.cpu_loop(0); | ||
| 68 | DEV_vga_refresh(); | ||
| 69 | stub_trace_flag = 0; | ||
| 70 | BX_INFO(("stopped with %x", last_stop_reason)); | ||
| 71 | buf[0] = 'S'; | ||
| 72 | - if (last_stop_reason == GDBSTUB_EXECUTION_BREAKPOINT || | ||
| 73 | - last_stop_reason == GDBSTUB_TRACE) | ||
| 74 | + if (last_stop_reason == GDBSTUB_TRACE && !bx_cpu.ispanic) | ||
| 75 | { | ||
| 76 | write_signal(&buf[1], SIGTRAP); | ||
| 77 | } | ||
| 78 | else | ||
| 79 | { | ||
| 80 | - write_signal(&buf[1], SIGTRAP); | ||
| 81 | + write_signal(&buf[1], SIGSEGV); | ||
| 82 | } | ||
| 83 | put_reply(buf); | ||
| 84 | break; | ||
| 85 | -- | ||
| 86 | 1.6.2.3 | ||
| 87 | |||
