From 0b99857b2ea02b083040e9789ddefed98e8cae3a Mon Sep 17 00:00:00 2001 From: Thiemo Seufer Date: Wed, 7 Sep 2005 23:03:16 +0000 Subject: [PATCH] In the mips sigtrap hander, and for the case of a break instruction in a branch delay slot we looked up the error code in the preceeding branch instruction instead of the break instruction. The result were unhandled sigtraps which killed SBCL. --- src/runtime/mips-arch.c | 21 +++++++++++---------- version.lisp-expr | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/runtime/mips-arch.c b/src/runtime/mips-arch.c index bfcff9c..63f9a66 100644 --- a/src/runtime/mips-arch.c +++ b/src/runtime/mips-arch.c @@ -53,7 +53,10 @@ os_context_pc(os_context_t *context) static inline unsigned int os_context_insn(os_context_t *context) { - return *(unsigned int *)(os_context_pc(context)); + if (os_context_bd_cause(context)) + return *(unsigned int *)(os_context_pc(context) + 4); + else + return *(unsigned int *)(os_context_pc(context)); } /* This function is somewhat misnamed, it actually just jumps to the @@ -150,9 +153,12 @@ emulate_branch(os_context_t *context, unsigned int inst) void arch_skip_instruction(os_context_t *context) { - /* Skip the offending instruction */ + /* Skip the offending instruction. Don't use os_context_insn here, + since in case of a branch we want the branch insn, not the delay + slot. */ *os_context_pc_addr(context) - = emulate_branch(context, os_context_insn(context)); + = emulate_branch(context, + *(unsigned int *)(os_context_pc(context))); } unsigned char * @@ -314,16 +320,11 @@ sigtrap_handler(int signal, siginfo_t *info, void *void_context) static void sigfpe_handler(int signal, siginfo_t *info, void *void_context) { - unsigned int bad_inst; + os_context_t *context = arch_os_get_context(&void_context); + unsigned int bad_inst = os_context_insn(context); unsigned int op, rs, rt, rd, funct, dest = 32; int immed; int result; - os_context_t *context = arch_os_get_context(&void_context); - - if (os_context_bd_cause(context)) - bad_inst = *(unsigned int *)(os_context_pc(context) + 4); - else - bad_inst = os_context_insn(context); op = (bad_inst >> 26) & 0x3f; rs = (bad_inst >> 21) & 0x1f; diff --git a/version.lisp-expr b/version.lisp-expr index d2ca197..ebccb0b 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.9.4.38" +"0.9.4.39" -- 1.7.10.4