From b5f0874cd96ee2a62aabc645b9626c2749cb6a01 Mon Sep 17 00:00:00 2001 From: manuel Date: Mon, 26 Mar 2012 12:54:45 +0200 Subject: initial pintos checkin --- .../misc/0002-bochs-2.3.7-triple-fault.patch | 87 ++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 pintos-progos/misc/0002-bochs-2.3.7-triple-fault.patch (limited to 'pintos-progos/misc/0002-bochs-2.3.7-triple-fault.patch') 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 @@ +From 356b7e781c815c70c992d58360caa42f1776d06b Mon Sep 17 00:00:00 2001 +From: Alex Busenius +Date: Mon, 27 Apr 2009 17:09:27 +0200 +Subject: bochs-2.3.7 triple fault + +--- + cpu/cpu.h | 4 ++++ + cpu/exception.cc | 7 +++++++ + gdbstub.cc | 11 ++++++++--- + 3 files changed, 19 insertions(+), 3 deletions(-) + +diff --git a/cpu/cpu.h b/cpu/cpu.h +index 7c7b11b..c47133a 100644 +--- a/cpu/cpu.h ++++ b/cpu/cpu.h +@@ -903,6 +903,10 @@ public: // for now... + #endif + Bit8u trace; + ++#if BX_GDBSTUB ++ Bit8u ispanic; ++#endif ++ + // for paging + struct { + bx_TLB_entry entry[BX_TLB_SIZE] BX_CPP_AlignN(16); +diff --git a/cpu/exception.cc b/cpu/exception.cc +index c3e3777..fb3abfc 100644 +--- a/cpu/exception.cc ++++ b/cpu/exception.cc +@@ -856,6 +856,13 @@ void BX_CPU_C::exception(unsigned vector, Bit16u error_code, bx_bool trap) + // trap into debugger (similar as done when PANIC occured) + bx_debug_break(); + #endif ++#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 (SIM->get_param_bool(BXPN_RESET_ON_TRIPLE_FAULT)->get()) { + BX_ERROR(("exception(): 3rd (%d) exception with no resolution, shutdown status is %02xh, resetting", vector, DEV_cmos_get_reg(0x0f))); + bx_pc_system.Reset(BX_RESET_SOFTWARE); +diff --git a/gdbstub.cc b/gdbstub.cc +index f58f866..bc5ed61 100644 +--- a/gdbstub.cc ++++ b/gdbstub.cc +@@ -471,7 +471,12 @@ static void debug_loop(void) + } + + stub_trace_flag = 0; ++ bx_cpu.ispanic = 0; + bx_cpu.cpu_loop(0); ++ if (bx_cpu.ispanic) ++ { ++ last_stop_reason = GDBSTUB_EXECUTION_BREAKPOINT; ++ } + + DEV_vga_refresh(); + +@@ -502,19 +507,19 @@ static void debug_loop(void) + + BX_INFO(("stepping")); + stub_trace_flag = 1; ++ bx_cpu.ispanic = 0; + bx_cpu.cpu_loop(0); + 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; +-- +1.6.2.3 + -- cgit v1.2.3