]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix build for NetBSD/ARM
authorShenghou Ma <minux.ma@gmail.com>
Mon, 18 Mar 2013 18:47:04 +0000 (02:47 +0800)
committerShenghou Ma <minux.ma@gmail.com>
Mon, 18 Mar 2013 18:47:04 +0000 (02:47 +0800)
R=golang-dev, jsing
CC=golang-dev
https://golang.org/cl/7597046

src/pkg/runtime/defs_netbsd.go
src/pkg/runtime/defs_netbsd_386.go
src/pkg/runtime/defs_netbsd_amd64.go
src/pkg/runtime/defs_netbsd_arm.go [new file with mode: 0644]
src/pkg/runtime/defs_netbsd_arm.h
src/pkg/runtime/os_netbsd_arm.c
src/pkg/runtime/signal_netbsd_arm.h
src/pkg/runtime/sys_netbsd_arm.s

index 53e061041e718baf73a8d46a63873d4935119310..c543593fa459b23d1a7c70a8855d6aa2788c6480 100644 (file)
@@ -9,6 +9,7 @@ Input to cgo.
 
 GOARCH=amd64 go tool cgo -cdefs defs_netbsd.go defs_netbsd_amd64.go >defs_netbsd_amd64.h
 GOARCH=386 go tool cgo -cdefs defs_netbsd.go defs_netbsd_386.go >defs_netbsd_386.h
+GOARCH=arm go tool cgo -cdefs defs_netbsd.go defs_netbsd_arm.go >defs_netbsd_arm.h
 */
 
 // +godefs map __fpregset_t [644]byte
index e9e36608e4cfb6d62655cce417f3b922bde77596..c26f246077f63be1fad342d9c161f94a8a3e8d80 100644 (file)
@@ -7,7 +7,6 @@
 /*
 Input to cgo.
 
-GOARCH=amd64 go tool cgo -cdefs defs_netbsd.go defs_netbsd_amd64.go >defs_netbsd_amd64.h
 GOARCH=386 go tool cgo -cdefs defs_netbsd.go defs_netbsd_386.go >defs_netbsd_386.h
 */
 
index 68f586b2f9c12b9abda528af8b74741719568fb4..f18a7b1fe32e773757df321bf7653e9f6f3620e1 100644 (file)
@@ -8,7 +8,6 @@
 Input to cgo.
 
 GOARCH=amd64 go tool cgo -cdefs defs_netbsd.go defs_netbsd_amd64.go >defs_netbsd_amd64.h
-GOARCH=386 go tool cgo -cdefs defs_netbsd.go defs_netbsd_386.go >defs_netbsd_386.h
 */
 
 package runtime
diff --git a/src/pkg/runtime/defs_netbsd_arm.go b/src/pkg/runtime/defs_netbsd_arm.go
new file mode 100644 (file)
index 0000000..cb0dce6
--- /dev/null
@@ -0,0 +1,39 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build ignore
+
+/*
+Input to cgo.
+
+GOARCH=arm go tool cgo -cdefs defs_netbsd.go defs_netbsd_arm.go >defs_netbsd_arm.h
+*/
+
+package runtime
+
+/*
+#include <sys/types.h>
+#include <machine/mcontext.h>
+*/
+import "C"
+
+const (
+       REG_R0   = C._REG_R0
+       REG_R1   = C._REG_R1
+       REG_R2   = C._REG_R2
+       REG_R3   = C._REG_R3
+       REG_R4   = C._REG_R4
+       REG_R5   = C._REG_R5
+       REG_R6   = C._REG_R6
+       REG_R7   = C._REG_R7
+       REG_R8   = C._REG_R8
+       REG_R9   = C._REG_R9
+       REG_R10  = C._REG_R10
+       REG_R11  = C._REG_R11
+       REG_R12  = C._REG_R12
+       REG_R13  = C._REG_R13
+       REG_R14  = C._REG_R14
+       REG_R15  = C._REG_R15
+       REG_CPSR = C._REG_CPSR
+)
index f67475c763bd306419c5b59af50774ae881c31d3..26b55222e2302f8d8f613798c91ad17a46ecf1e8 100644 (file)
@@ -1,5 +1,5 @@
 // Created by cgo -cdefs - DO NOT EDIT
-// cgo -cdefs defs_netbsd.go
+// cgo -cdefs defs_netbsd.go defs_netbsd_arm.go
 
 
 enum {
@@ -138,3 +138,27 @@ struct UcontextT {
 };
 
 #pragma pack off
+// Created by cgo -cdefs - DO NOT EDIT
+// cgo -cdefs defs_netbsd.go defs_netbsd_arm.go
+
+
+enum {
+       REG_R0          = 0x0,
+       REG_R1          = 0x1,
+       REG_R2          = 0x2,
+       REG_R3          = 0x3,
+       REG_R4          = 0x4,
+       REG_R5          = 0x5,
+       REG_R6          = 0x6,
+       REG_R7          = 0x7,
+       REG_R8          = 0x8,
+       REG_R9          = 0x9,
+       REG_R10         = 0xa,
+       REG_R11         = 0xb,
+       REG_R12         = 0xc,
+       REG_R13         = 0xd,
+       REG_R14         = 0xe,
+       REG_R15         = 0xf,
+       REG_CPSR        = 0x10,
+};
+
index f188a3063851e8b508cd7af6e8d270375b79a9f2..385e6406d0637028429311168ee9b9af353e7142 100644 (file)
@@ -5,15 +5,16 @@
 #include "runtime.h"
 #include "defs_GOOS_GOARCH.h"
 #include "os_GOOS.h"
+#include "signal_GOOS_GOARCH.h"
 
 void
 runtime·lwp_mcontext_init(McontextT *mc, void *stack, M *mp, G *gp, void (*fn)(void))
 {
-       mc->r15 = (uint32)runtime·lwp_tramp;
-       mc->r13 = (uint32)stack;
-       mc->r0 = (uint32)mp;
-       mc->r1 = (uint32)gp;
-       mc->r2 = (uint32)fn;
+       mc->__gregs[REG_R15] = (uint32)runtime·lwp_tramp;
+       mc->__gregs[REG_R13] = (uint32)stack;
+       mc->__gregs[REG_R0] = (uint32)mp;
+       mc->__gregs[REG_R1] = (uint32)gp;
+       mc->__gregs[REG_R2] = (uint32)fn;
 }
 
 void
index cc0da1e9f9934992c8fd1f08faa3988545c8b366..12f5827a6cd7dbc536a91f830a5d40134908e25b 100644 (file)
@@ -4,24 +4,27 @@
 
 #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])
-#define SIG_R2(info, ctxt) (SIG_REGS(ctxt).__gregs[2])
-#define SIG_R3(info, ctxt) (SIG_REGS(ctxt).__gregs[3])
-#define SIG_R4(info, ctxt) (SIG_REGS(ctxt).__gregs[4])
-#define SIG_R5(info, ctxt) (SIG_REGS(ctxt).__gregs[5])
-#define SIG_R6(info, ctxt) (SIG_REGS(ctxt).__gregs[6])
-#define SIG_R7(info, ctxt) (SIG_REGS(ctxt).__gregs[7])
-#define SIG_R8(info, ctxt) (SIG_REGS(ctxt).__gregs[8])
-#define SIG_R9(info, ctxt) (SIG_REGS(ctxt).__gregs[9])
-#define SIG_R10(info, ctxt) (SIG_REGS(ctxt).__gregs[10])
-#define SIG_FP(info, ctxt) (SIG_REGS(ctxt).__gregs[11])
-#define SIG_IP(info, ctxt) (SIG_REGS(ctxt).__gregs[12])
-#define SIG_SP(info, ctxt) (SIG_REGS(ctxt).__gregs[13])
-#define SIG_LR(info, ctxt) (SIG_REGS(ctxt).__gregs[14])
-#define SIG_PC(info, ctxt) (SIG_REGS(ctxt).__gregs[15])
-#define SIG_CPSR(info, ctxt) (SIG_REGS(ctxt).__gregs[16])
+#define SIG_R0(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R0])
+#define SIG_R1(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R1])
+#define SIG_R2(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R2])
+#define SIG_R3(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R3])
+#define SIG_R4(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R4])
+#define SIG_R5(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R5])
+#define SIG_R6(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R6])
+#define SIG_R7(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R7])
+#define SIG_R8(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R8])
+#define SIG_R9(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R9])
+#define SIG_R10(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R10])
+#define SIG_FP(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R11])
+#define SIG_IP(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R12])
+#define SIG_SP(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R13])
+#define SIG_LR(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R14])
+#define SIG_PC(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R15])
+#define SIG_CPSR(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_CPSR])
 #define SIG_FAULT(info, ctxt) (*(uintptr*)&(info)->_reason[0])
 #define SIG_TRAP(info, ctxt) (0)
 #define SIG_ERROR(info, ctxt) (0)
 #define SIG_OLDMASK(info, ctxt) (0)
+
+#define SIG_CODE0(info, ctxt) ((info)->_code)
+#define SIG_CODE1(info, ctxt) (*(uintptr*)&(info)->_reason[0])
index fc64b1096d12c7ae755d2bb7ecd81b34d7beb5a0..3ff335f4df7042d292a17ebfcdea8d1421dea2c8 100644 (file)
@@ -21,6 +21,25 @@ TEXT runtime·exit1(SB),7,$-4
        MOVW $1, R9     // crash
        MOVW R9, (R9)
        RET
+       
+TEXT runtime·open(SB),7,$-8
+       MOVW 0(FP), R0
+       MOVW 4(FP), R1
+       MOVW 8(FP), R2
+       SWI $0xa00005
+       RET
+
+TEXT runtime·close(SB),7,$-8
+       MOVW 0(FP), R0
+       SWI $0xa00006
+       RET
+
+TEXT runtime·read(SB),7,$-8
+       MOVW 0(FP), R0
+       MOVW 4(FP), R1
+       MOVW 8(FP), R2
+       SWI $0xa00003
+       RET
 
 TEXT runtime·write(SB),7,$-4
        MOVW    0(FP), R0       // arg 1 - fd