aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorDavid Crawshaw <crawshaw@golang.org>2015-10-27 19:46:49 -0400
committerDavid Crawshaw <crawshaw@golang.org>2015-11-17 16:28:18 +0000
commitce8f49f42ff98a87a6766aa50efa0449c4525ce3 (patch)
tree9750e774fcf23cccfa156842243942b47726b80d /src/runtime
parentbabdb3832072b6ca55e2dfe071bac25d865f8911 (diff)
downloadgo-ce8f49f42ff98a87a6766aa50efa0449c4525ce3.tar.xz
runtime: android/arm64 support
Not all tests passing yet, but a good chunk are. Change-Id: I5daebaeabf3aecb380674ece8830a86751a8d139 Reviewed-on: https://go-review.googlesource.com/16458 Reviewed-by: Rahul Chaudhry <rahulchaudhry@google.com> Reviewed-by: David Crawshaw <crawshaw@golang.org>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/defs_linux_arm64.go9
-rw-r--r--src/runtime/os_android.go (renamed from src/runtime/os_android_arm.go)0
-rw-r--r--src/runtime/rt0_android_arm64.s13
-rw-r--r--src/runtime/sys_linux_arm64.s33
-rw-r--r--src/runtime/tls_arm64.h6
5 files changed, 61 insertions, 0 deletions
diff --git a/src/runtime/defs_linux_arm64.go b/src/runtime/defs_linux_arm64.go
index 1a4d8846e3..d1b1a3677f 100644
--- a/src/runtime/defs_linux_arm64.go
+++ b/src/runtime/defs_linux_arm64.go
@@ -87,6 +87,10 @@ const (
_EPOLL_CTL_ADD = 0x1
_EPOLL_CTL_DEL = 0x2
_EPOLL_CTL_MOD = 0x3
+
+ _AF_UNIX = 0x1
+ _F_SETFL = 0x4
+ _SOCK_DGRAM = 0x2
)
type timespec struct {
@@ -167,6 +171,11 @@ type sigcontext struct {
__reserved [4096]byte
}
+type sockaddr_un struct {
+ family uint16
+ path [108]byte
+}
+
type ucontext struct {
uc_flags uint64
uc_link *ucontext
diff --git a/src/runtime/os_android_arm.go b/src/runtime/os_android.go
index 52c8c86ee8..52c8c86ee8 100644
--- a/src/runtime/os_android_arm.go
+++ b/src/runtime/os_android.go
diff --git a/src/runtime/rt0_android_arm64.s b/src/runtime/rt0_android_arm64.s
new file mode 100644
index 0000000000..729147673e
--- /dev/null
+++ b/src/runtime/rt0_android_arm64.s
@@ -0,0 +1,13 @@
+// Copyright 2015 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.
+
+#include "textflag.h"
+
+TEXT _rt0_arm64_android(SB),NOSPLIT,$-8
+ MOVD $_rt0_arm64_linux(SB), R4
+ B (R4)
+
+TEXT _rt0_arm64_android_lib(SB),NOSPLIT,$-8
+ MOVD $_rt0_arm64_linux_lib(SB), R4
+ B (R4)
diff --git a/src/runtime/sys_linux_arm64.s b/src/runtime/sys_linux_arm64.s
index 7b58d67305..ca0e07aaa4 100644
--- a/src/runtime/sys_linux_arm64.s
+++ b/src/runtime/sys_linux_arm64.s
@@ -43,6 +43,9 @@
#define SYS_epoll_ctl 21
#define SYS_epoll_pwait 22
#define SYS_clock_gettime 113
+#define SYS_faccessat 48
+#define SYS_socket 198
+#define SYS_connect 203
TEXT runtime·exit(SB),NOSPLIT,$-8-4
MOVW code+0(FP), R0
@@ -445,3 +448,33 @@ TEXT runtime·closeonexec(SB),NOSPLIT,$-8
MOVD $SYS_fcntl, R8
SVC
RET
+
+// int access(const char *name, int mode)
+TEXT runtime·access(SB),NOSPLIT,$0-20
+ MOVD $AT_FDCWD, R0
+ MOVD name+0(FP), R1
+ MOVW mode+8(FP), R2
+ MOVD $SYS_faccessat, R8
+ SVC
+ MOVW R0, ret+16(FP)
+ RET
+
+// int connect(int fd, const struct sockaddr *addr, socklen_t len)
+TEXT runtime·connect(SB),NOSPLIT,$0-28
+ MOVW fd+0(FP), R0
+ MOVD addr+8(FP), R1
+ MOVW len+16(FP), R2
+ MOVD $SYS_connect, R8
+ SVC
+ MOVW R0, ret+24(FP)
+ RET
+
+// int socket(int domain, int typ, int prot)
+TEXT runtime·socket(SB),NOSPLIT,$0-20
+ MOVW domain+0(FP), R0
+ MOVW typ+4(FP), R1
+ MOVW prot+8(FP), R2
+ MOVD $SYS_socket, R8
+ SVC
+ MOVW R0, ret+16(FP)
+ RET
diff --git a/src/runtime/tls_arm64.h b/src/runtime/tls_arm64.h
index d5676aba34..0fdc750d0f 100644
--- a/src/runtime/tls_arm64.h
+++ b/src/runtime/tls_arm64.h
@@ -2,7 +2,13 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+#ifdef GOOS_android
+#define TLS_linux
+#endif
#ifdef GOOS_linux
+#define TLS_linux
+#endif
+#ifdef TLS_linux
#define TPIDR TPIDR_EL0
#define MRS_TPIDR_R0 WORD $0xd53bd040 // MRS TPIDR_EL0, R0
#endif