]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: unbreak netbsd builds
authorJoel Sing <jsing@google.com>
Fri, 15 Mar 2013 15:43:43 +0000 (11:43 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 15 Mar 2013 15:43:43 +0000 (11:43 -0400)
Fix signal handling so that Go builds on NetBSD.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7759048

src/pkg/runtime/signal_386.c
src/pkg/runtime/signal_amd64.c
src/pkg/runtime/signal_arm.c
src/pkg/runtime/signal_netbsd_386.h
src/pkg/runtime/signal_netbsd_amd64.h
src/pkg/runtime/signal_netbsd_arm.h

index c409aee5070b7f21d5d1bdeb5ec04d45760bea43..72b4a66f85166435f41f023614d85f2054640e60 100644 (file)
@@ -45,7 +45,7 @@ runtime·sighandler(int32 sig, Siginfo *info, void *ctxt, G *gp)
        }
 
        t = &runtime·sigtab[sig];
-       if(info->si_code != SI_USER && (t->flags & SigPanic)) {
+       if(SIG_CODE0(info, ctxt) != SI_USER && (t->flags & SigPanic)) {
                if(gp == nil || gp == m->g0)
                        goto Throw;
 
@@ -87,7 +87,7 @@ runtime·sighandler(int32 sig, Siginfo *info, void *ctxt, G *gp)
                return;
        }
 
-       if(info->si_code == SI_USER || (t->flags & SigNotify))
+       if(SIG_CODE0(info, ctxt) == SI_USER || (t->flags & SigNotify))
                if(runtime·sigsend(sig))
                        return;
        if(t->flags & SigKill)
index 157e0ee46da74c665f7d17395d3fa750fd95b061..ce17bf36d0e10861b83dc8142e4b54b4ae17e5d5 100644 (file)
@@ -53,7 +53,7 @@ runtime·sighandler(int32 sig, Siginfo *info, void *ctxt, G *gp)
        }
 
        t = &runtime·sigtab[sig];
-       if(info->si_code != SI_USER && (t->flags & SigPanic)) {
+       if(SIG_CODE0(info, ctxt) != SI_USER && (t->flags & SigPanic)) {
                if(gp == nil || gp == m->g0)
                        goto Throw;
 
@@ -97,7 +97,7 @@ runtime·sighandler(int32 sig, Siginfo *info, void *ctxt, G *gp)
                return;
        }
 
-       if(info->si_code == SI_USER || (t->flags & SigNotify))
+       if(SIG_CODE0(info, ctxt) == SI_USER || (t->flags & SigNotify))
                if(runtime·sigsend(sig))
                        return;
        if(t->flags & SigKill)
index a7f373bd5e397388a41e534c2bcb43369559a21a..adf61de6bf38d50401ec27ea7f8236c78931203f 100644 (file)
@@ -52,7 +52,7 @@ runtime·sighandler(int32 sig, Siginfo *info, void *ctxt, G *gp)
        }
 
        t = &runtime·sigtab[sig];
-       if(info->si_code != SI_USER && (t->flags & SigPanic)) {
+       if(SIG_CODE0(info, ctxt) != SI_USER && (t->flags & SigPanic)) {
                if(gp == nil || gp == m->g0)
                        goto Throw;
 
@@ -85,7 +85,7 @@ runtime·sighandler(int32 sig, Siginfo *info, void *ctxt, G *gp)
                return;
        }
 
-       if(info->si_code == SI_USER || (t->flags & SigNotify))
+       if(SIG_CODE0(info, ctxt) == SI_USER || (t->flags & SigNotify))
                if(runtime·sigsend(sig))
                        return;
        if(t->flags & SigKill)
index 9cbd0385dfbef4ba39ac1f3289ec9dfba877c9d1..d5a8a0c4bcfa78322838a438d153d619e544f01c 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-#define SIG_REGS(ctxt) (((Ucontext*)(ctxt))->uc_mcontext)
+#define SIG_REGS(ctxt) (((UcontextT*)(ctxt))->uc_mcontext)
 
 #define SIG_EAX(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_EAX])
 #define SIG_EBX(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_EBX])
@@ -11,9 +11,9 @@
 #define SIG_EDI(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_EDI])
 #define SIG_ESI(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_ESI])
 #define SIG_EBP(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_EBP])
-#define SIG_ESP(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_ESP])
+#define SIG_ESP(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_UESP])
 #define SIG_EIP(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_EIP])
-#define SIG_EFLAGS(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_EFLAGS])
+#define SIG_EFLAGS(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_EFL])
 
 #define SIG_CS(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_CS])
 #define SIG_FS(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_FS])
index 4a339c1656b5be99043bb5b5b94c1f067267bae6..7ec4cd98cd9b2cfd64759f8ed82720435dd049a9 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-#define SIG_REGS(ctxt) (((Ucontext*)(ctxt))->uc_mcontext)
+#define SIG_REGS(ctxt) (((UcontextT*)(ctxt))->uc_mcontext)
 
 #define SIG_RAX(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_RAX])
 #define SIG_RBX(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_RBX])
index 16df26df4b20c883a3eae912c7e28f1d89489e01..cc0da1e9f9934992c8fd1f08faa3988545c8b366 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-#define SIG_REGS(ctxt) (((Ucontext*)(ctxt))->uc_mcontext)
+#define SIG_REGS(ctxt) (((UcontextT*)(ctxt))->uc_mcontext)
 
 #define SIG_R0(info, ctxt) (SIG_REGS(ctxt).__gregs[0])
 #define SIG_R1(info, ctxt) (SIG_REGS(ctxt).__gregs[1])