diff options
Diffstat (limited to 'misc/0003-bochs-2.3.7-page-fault-segv.patch')
| -rw-r--r-- | misc/0003-bochs-2.3.7-page-fault-segv.patch | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/misc/0003-bochs-2.3.7-page-fault-segv.patch b/misc/0003-bochs-2.3.7-page-fault-segv.patch new file mode 100644 index 0000000..8b6e090 --- /dev/null +++ b/misc/0003-bochs-2.3.7-page-fault-segv.patch | |||
| @@ -0,0 +1,93 @@ | |||
| 1 | From 314833401978558db06bbb4f4f76e4dc7b603744 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Alex Busenius <s9albuse@stud.uni-saarland.de> | ||
| 3 | Date: Mon, 27 Apr 2009 16:33:54 +0200 | ||
| 4 | Subject: bochs-2.3.7 page fault segv | ||
| 5 | |||
| 6 | --- | ||
| 7 | bochs.h | 1 + | ||
| 8 | cpu/exception.cc | 4 ++++ | ||
| 9 | gdbstub.cc | 17 ++++++++++++++++- | ||
| 10 | 3 files changed, 21 insertions(+), 1 deletions(-) | ||
| 11 | |||
| 12 | diff --git a/bochs.h b/bochs.h | ||
| 13 | index 75bcd96..657c7b8 100644 | ||
| 14 | --- a/bochs.h | ||
| 15 | +++ b/bochs.h | ||
| 16 | @@ -433,6 +433,7 @@ BOCHSAPI extern logfunc_t *genlog; | ||
| 17 | void bx_gdbstub_init(void); | ||
| 18 | void bx_gdbstub_break(void); | ||
| 19 | int bx_gdbstub_check(unsigned int eip); | ||
| 20 | +void bx_gdbstub_exception(unsigned int nr); | ||
| 21 | #define GDBSTUB_STOP_NO_REASON (0xac0) | ||
| 22 | |||
| 23 | #if BX_SUPPORT_SMP | ||
| 24 | diff --git a/cpu/exception.cc b/cpu/exception.cc | ||
| 25 | index fb3abfc..8dac5ca 100644 | ||
| 26 | --- a/cpu/exception.cc | ||
| 27 | +++ b/cpu/exception.cc | ||
| 28 | @@ -1046,6 +1046,10 @@ void BX_CPU_C::exception(unsigned vector, Bit16u error_code, bx_bool trap) | ||
| 29 | |||
| 30 | BX_CPU_THIS_PTR errorno++; | ||
| 31 | |||
| 32 | +#if BX_GDBSTUB | ||
| 33 | + bx_gdbstub_exception(vector); | ||
| 34 | +#endif | ||
| 35 | + | ||
| 36 | if (real_mode()) { | ||
| 37 | // not INT, no error code pushed | ||
| 38 | BX_CPU_THIS_PTR interrupt(vector, 0, 0, 0); | ||
| 39 | diff --git a/gdbstub.cc b/gdbstub.cc | ||
| 40 | index bc5ed61..ad59373 100644 | ||
| 41 | --- a/gdbstub.cc | ||
| 42 | +++ b/gdbstub.cc | ||
| 43 | @@ -47,6 +47,7 @@ static int last_stop_reason = GDBSTUB_STOP_NO_REASON; | ||
| 44 | #define GDBSTUB_EXECUTION_BREAKPOINT (0xac1) | ||
| 45 | #define GDBSTUB_TRACE (0xac2) | ||
| 46 | #define GDBSTUB_USER_BREAK (0xac3) | ||
| 47 | +#define GDBSTUB_EXCEPTION_0E (0xac4) | ||
| 48 | |||
| 49 | static bx_list_c *gdbstub_list; | ||
| 50 | static int listen_socket_fd; | ||
| 51 | @@ -323,6 +324,12 @@ int bx_gdbstub_check(unsigned int eip) | ||
| 52 | return GDBSTUB_STOP_NO_REASON; | ||
| 53 | } | ||
| 54 | |||
| 55 | +void bx_gdbstub_exception(unsigned int nr) | ||
| 56 | +{ | ||
| 57 | + if (nr == 0x0e) | ||
| 58 | + last_stop_reason = GDBSTUB_EXCEPTION_0E; | ||
| 59 | +} | ||
| 60 | + | ||
| 61 | static int remove_breakpoint(unsigned int addr, int len) | ||
| 62 | { | ||
| 63 | unsigned int i; | ||
| 64 | @@ -493,6 +500,10 @@ static void debug_loop(void) | ||
| 65 | { | ||
| 66 | write_signal(&buf[1], SIGTRAP); | ||
| 67 | } | ||
| 68 | + else if (last_stop_reason == GDBSTUB_EXCEPTION_0E) | ||
| 69 | + { | ||
| 70 | + write_signal(&buf[1], SIGSEGV); | ||
| 71 | + } | ||
| 72 | else | ||
| 73 | { | ||
| 74 | write_signal(&buf[1], 0); | ||
| 75 | @@ -517,10 +528,14 @@ static void debug_loop(void) | ||
| 76 | { | ||
| 77 | write_signal(&buf[1], SIGTRAP); | ||
| 78 | } | ||
| 79 | - else | ||
| 80 | + else if (last_stop_reason == GDBSTUB_EXCEPTION_0E) | ||
| 81 | { | ||
| 82 | write_signal(&buf[1], SIGSEGV); | ||
| 83 | } | ||
| 84 | + else | ||
| 85 | + { | ||
| 86 | + write_signal(&buf[1], 0); | ||
| 87 | + } | ||
| 88 | put_reply(buf); | ||
| 89 | break; | ||
| 90 | } | ||
| 91 | -- | ||
| 92 | 1.6.2.3 | ||
| 93 | |||
