0.7.4.40:
[sbcl.git] / src / runtime / sparc-arch.c
index 6f6cde2..c2bfd22 100644 (file)
@@ -23,7 +23,7 @@
 #include "breakpoint.h"
 #include "monitor.h"
 
-#ifdef linux
+#ifdef LISP_FEATURE_LINUX
 extern int early_kernel;
 #endif
 
@@ -86,7 +86,7 @@ os_vm_address_t arch_get_bad_addr(int sig, siginfo_t *code, os_context_t *contex
 void arch_skip_instruction(os_context_t *context)
 {
   ((char *) *os_context_pc_addr(context)) = ((char *) *os_context_npc_addr(context));
-  context->si_regs.npc += 4;
+  ((char *) *os_context_npc_addr(context)) += 4;
 }
 
 unsigned char *arch_internal_error_arguments(os_context_t *context)
@@ -128,7 +128,7 @@ void arch_do_displaced_inst(os_context_t *context, unsigned int orig_inst)
 {
   unsigned long *pc = (unsigned long *)(*os_context_pc_addr(context));
   /* FIXME */
-  unsigned long *npc = &context->si_regs.npc;
+  unsigned long *npc = (unsigned long *)(*os_context_npc_addr(context));
 
   /*  orig_sigmask = context->sigmask;
       sigemptyset(&context->sigmask); */
@@ -142,8 +142,6 @@ void arch_do_displaced_inst(os_context_t *context, unsigned int orig_inst)
   *npc = trap_AfterBreakpoint;
   os_flush_icache((os_vm_address_t) npc, sizeof(unsigned long));
 
-  /* How much is this not going to work? */
-  sigreturn(context);
 }
 
 static int pseudo_atomic_trap_p(os_context_t *context)
@@ -157,15 +155,9 @@ static int pseudo_atomic_trap_p(os_context_t *context)
   badinst = *pc;
   result = 0;
 
-  /* Check to see if the current instruction is a trap #x40 */
-  /* FIXME: As written, this will not work when someone comes to port
-     this to Solaris. We have chosen trap 0x40 on SPARC Linux because
-     trap 0x10, used in CMUCL/Solaris, generates a sigtrap rather than
-     a sigill. This number should not be hardcoded, but should come,
-     if possible, from src/compiler/target/parms.lisp via sbcl.h --
-     CSR */
+  /* Check to see if the current instruction is a pseudo-atomic-trap */
   if (((badinst >> 30) == 2) && (((badinst >> 19) & 0x3f) == 0x3a)
-      && (((badinst >> 13) & 1) == 1) && ((badinst & 0x7f) == 0x40))
+      && (((badinst >> 13) & 1) == 1) && ((badinst & 0x7f) == PSEUDO_ATOMIC_TRAP))
     {
       unsigned int previnst;
       previnst = pc[-1];
@@ -183,9 +175,7 @@ static int pseudo_atomic_trap_p(os_context_t *context)
         }
       else
         {
-         /* FIXME: in the light of the comment above, this fprintf is
-             bogus. CSR */
-          fprintf(stderr, "Oops!  Got a trap 16 without a preceeding andcc!\n");
+          fprintf(stderr, "Oops!  Got a PSEUDO-ATOMIC-TRAP without a preceeding andcc!\n");
         }
     }
   return result;
@@ -195,10 +185,10 @@ static void sigill_handler(int signal, siginfo_t *siginfo, void *void_context)
 {
   os_context_t *context = arch_os_get_context(&void_context);
 
-  sigprocmask(SIG_SETMASK, &context->si_mask, 0);
+  sigprocmask(SIG_SETMASK, os_context_sigmask_addr(context), 0);
 
   if ((siginfo->si_code) == ILL_ILLOPC
-#ifdef linux
+#ifdef LISP_FEATURE_LINUX
       || (early_kernel && (siginfo->si_code == 2))
 #endif
       ) {
@@ -230,7 +220,7 @@ static void sigill_handler(int signal, siginfo_t *siginfo, void *void_context)
 
     case trap_FunEndBreakpoint:
       *os_context_pc_addr(context) = (int) handle_fun_end_breakpoint(signal, siginfo, context);
-      context->si_regs.npc = *os_context_pc_addr(context) + 4;
+      *os_context_npc_addr(context) = *os_context_pc_addr(context) + 4;
       break;
 
     case trap_AfterBreakpoint:
@@ -247,7 +237,7 @@ static void sigill_handler(int signal, siginfo_t *siginfo, void *void_context)
     }
   }
   else if ((siginfo->si_code) == ILL_ILLTRP
-#ifdef linux
+#ifdef LISP_FEATURE_LINUX
           || (early_kernel && (siginfo->si_code) == 192)
 #endif
           ) {
@@ -397,3 +387,4 @@ lispobj funcall3(lispobj function, lispobj arg0, lispobj arg1, lispobj arg2)
 
     return call_into_lisp(function, args, 3);
 }
+