0.8.9.6.netbsd.2:
[sbcl.git] / src / runtime / x86-arch.c
index d2213d5..fbe318b 100644 (file)
@@ -24,6 +24,7 @@
 #include "interr.h"
 #include "breakpoint.h"
 #include "monitor.h"
+#include "thread.h"
 
 #include "genesis/static-symbols.h"
 #include "genesis/symbol.h"
@@ -54,8 +55,10 @@ context_eflags_addr(os_context_t *context)
     return &context->uc_mcontext.gregs[16];
 #elif defined __FreeBSD__
     return &context->uc_mcontext.mc_eflags;
-#elif defined __OpenBSD__
+#elif defined __OpenBSD__ || defined __NetBSD__
     return &context->sc_eflags;
+#elif defined __NetBSD__
+    return &(context->uc_mcontext.__gregs[_REG_EFL]);
 #else
 #error unsupported OS
 #endif
@@ -71,8 +74,7 @@ void arch_skip_instruction(os_context_t *context)
     int vlen;
     int code;
 
-    FSHOW((stderr, "/[arch_skip_inst at %x]\n", *os_context_pc_addr(context)));
-
+    
     /* Get and skip the Lisp interrupt code. */
     code = *(char*)(*os_context_pc_addr(context))++;
     switch (code)
@@ -115,13 +117,14 @@ arch_internal_error_arguments(os_context_t *context)
 boolean
 arch_pseudo_atomic_atomic(os_context_t *context)
 {
-    return SymbolValue(PSEUDO_ATOMIC_ATOMIC);
+    return SymbolValue(PSEUDO_ATOMIC_ATOMIC,arch_os_get_current_thread());
 }
 
 void
 arch_set_pseudo_atomic_interrupted(os_context_t *context)
 {
-    SetSymbolValue(PSEUDO_ATOMIC_INTERRUPTED, make_fixnum(1));
+    SetSymbolValue(PSEUDO_ATOMIC_INTERRUPTED, make_fixnum(1),
+                  arch_os_get_current_thread());
 }
 \f
 /*
@@ -190,6 +193,7 @@ sigtrap_handler(int signal, siginfo_t *info, void *void_context)
     int code = info->si_code;
     os_context_t *context = (os_context_t*)void_context;
     unsigned int trap;
+    sigset_t ss;
 
     if (single_stepping && (signal==SIGTRAP))
     {
@@ -240,6 +244,9 @@ sigtrap_handler(int signal, siginfo_t *info, void *void_context)
     case trap_PendingInterrupt:
        FSHOW((stderr, "/<trap pending interrupt>\n"));
        arch_skip_instruction(context);
+       sigemptyset(&ss);
+       sigaddset(&ss,SIGTRAP);
+       sigprocmask(SIG_UNBLOCK,&ss,0);
        interrupt_handle_pending(context);
        break;
 
@@ -316,6 +323,7 @@ call_into_lisp(lispobj fun, lispobj *args, int nargs);
  * could be in registers depending on what the compiler likes. So we
  * copy the args into a portable vector and let the assembly language
  * call-in function figure it out. */
+
 lispobj
 funcall0(lispobj function)
 {