From 539339c130d0556d628de8c2b9e6f36b8051c0ce Mon Sep 17 00:00:00 2001 From: nyef Date: Thu, 11 Oct 2012 18:13:02 +0000 Subject: [PATCH] src/runtime/sparc-arch.c: Use si_addr in arch_get_bad_addr(). * Since the sparc port was first merged, arch_get_bad_addr() has only worked when the program counter is within read-only or the current dynamic space. * This is fragile simply because of the existance of static space and PURIFY. It is WORSE when you add GENCGC to the mix (to the point where SunOS with GENCGC doesn't even call arch_get_bad_addr() anymore). * The existing implementation looks like it predates the switch to sigaction(2) style signal handlers. SBCL uses si_addr on all other backends save Alpha (long undermaintained) and HPPA (even longer undermaintained). Clearly, this approach works on SunOS. From testing, it works on at least linux-2.6.32. We might as well run with it, since we need it for GENCGC anyway, and we can easily concoct a test case that would cause a failure using CHENEYGC. * So, implementation patterned on any of the other backends, but leaving the old code in place, conditional-compiled out, as a bit of a historical note / warning to future historians. --- src/runtime/sparc-arch.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/runtime/sparc-arch.c b/src/runtime/sparc-arch.c index aa0fef6..2eee865 100644 --- a/src/runtime/sparc-arch.c +++ b/src/runtime/sparc-arch.c @@ -35,6 +35,9 @@ void arch_init(void) os_vm_address_t arch_get_bad_addr(int sig, siginfo_t *code, os_context_t *context) { +#if 1 /* New way. */ + return (os_vm_address_t)code->si_addr; +#else /* Old way, almost certainly predates sigaction(2)-style handlers */ unsigned int badinst; unsigned int *pc; int rs1; @@ -82,6 +85,7 @@ os_vm_address_t arch_get_bad_addr(int sig, siginfo_t *code, os_context_t *contex (*os_context_register_addr(context, rs1) + *os_context_register_addr(context, rs2)); } +#endif } void arch_skip_instruction(os_context_t *context) -- 1.7.10.4