From a0e73d383085ae1f24af47ef3a3be98193a3b61b Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 8 Apr 2006 20:42:43 +0000 Subject: [PATCH] Add patch to make a triple fault break to the gdb stub if active. --- src/misc/bochs-2.2.6-build.sh | 1 + src/misc/bochs-2.2.6-triple-fault.patch | 30 +++++++++++++++++++++++++ src/misc/bochs-2.2.6.README | 6 +++++ 3 files changed, 37 insertions(+) create mode 100644 src/misc/bochs-2.2.6-triple-fault.patch diff --git a/src/misc/bochs-2.2.6-build.sh b/src/misc/bochs-2.2.6-build.sh index 3245b42..5b09991 100755 --- a/src/misc/bochs-2.2.6-build.sh +++ b/src/misc/bochs-2.2.6-build.sh @@ -17,6 +17,7 @@ cd bochs-2.2.6 cat $PINTOSDIR/src/misc/bochs-2.2.6-ms-extensions.patch | patch -p1 cat $PINTOSDIR/src/misc/bochs-2.2.6-big-endian.patch | patch -p1 cat $PINTOSDIR/src/misc/bochs-2.2.6-jitter.patch | patch -p1 +cat $PINTOSDIR/src/misc/bochs-2.2.6-triple-fault.patch | patch -p1 if test "`uname -s`" = "SunOS"; then cat $PINTOSDIR/src/misc/bochs-2.2.6-solaris.patch | patch -p1 fi diff --git a/src/misc/bochs-2.2.6-triple-fault.patch b/src/misc/bochs-2.2.6-triple-fault.patch new file mode 100644 index 0000000..06da80e --- /dev/null +++ b/src/misc/bochs-2.2.6-triple-fault.patch @@ -0,0 +1,30 @@ +--- 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 + + 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"); ++ 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 + + /* 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"); ++ 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 --git a/src/misc/bochs-2.2.6.README b/src/misc/bochs-2.2.6.README index 3d38b54..1224dd7 100644 --- a/src/misc/bochs-2.2.6.README +++ b/src/misc/bochs-2.2.6.README @@ -12,6 +12,11 @@ patches for this version of Bochs are included: Adds the `jitter' feature described in the project documentation, in which timer interrupts are delivered at random intervals. + bochs-2.2.6-triple-fault.patch + + Causes Bochs to break to GDB when a triple fault occurs and + the GDB stub is active. + bochs-2.2.6-ms-extensions.patch Needed for Bochs to compile with GCC on some hosts. Probably @@ -24,6 +29,7 @@ patches for this version of Bochs are included: To apply all the patches, cd into the Bochs directory, then type patch -p1 < $PINTOSDIR/src/misc/bochs-2.2.6-big-endian.patch patch -p1 < $PINTOSDIR/src/misc/bochs-2.2.6-jitter.patch + patch -p1 < $PINTOSDIR/src/misc/bochs-2.2.6-triple-fault.patch patch -p1 < $PINTOSDIR/src/misc/bochs-2.2.6-ms-extensions.patch patch -p1 < $PINTOSDIR/src/misc/bochs-2.2.6-solaris.patch You will have to supply the proper $PINTOSDIR, of course. You can use -- 2.30.2