src/runtime/sparc-arch.c: Use si_addr in arch_get_bad_addr().
authornyef <nyef@sunblade100.lisphacker.com>
Thu, 11 Oct 2012 18:13:02 +0000 (18:13 +0000)
committernyef <nyef@sunblade100.lisphacker.com>
Fri, 19 Oct 2012 17:38:05 +0000 (17:38 +0000)
  * 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

index aa0fef6..2eee865 100644 (file)
@@ -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)