aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sys_freebsd_arm.s
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2019-04-03 16:31:13 -0700
committerIan Lance Taylor <iant@golang.org>2019-10-20 21:15:55 +0000
commit3b0aa546d289390027ee1bf1a5e41f37f6131fa7 (patch)
tree631fafe6c7e524f3c27b5c58581bad68b0334390 /src/runtime/sys_freebsd_arm.s
parent504fce98ba3052135ec1f9564e06819f42cdbc86 (diff)
downloadgo-3b0aa546d289390027ee1bf1a5e41f37f6131fa7.tar.gz
go-3b0aa546d289390027ee1bf1a5e41f37f6131fa7.zip
runtime: define nonblockingPipe
This requires defining pipe, pipe2, and setNonblock for various platforms. The new function is currently only used on AIX. It will be used by later CLs in this series. Updates #27707 Change-Id: Id2f987b66b4c66a3ef40c22484ff1d14f58e9b31 Reviewed-on: https://go-review.googlesource.com/c/go/+/171822 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/runtime/sys_freebsd_arm.s')
-rw-r--r--src/runtime/sys_freebsd_arm.s42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/runtime/sys_freebsd_arm.s b/src/runtime/sys_freebsd_arm.s
index 1bdc10681a..27b45888f4 100644
--- a/src/runtime/sys_freebsd_arm.s
+++ b/src/runtime/sys_freebsd_arm.s
@@ -20,6 +20,7 @@
#define SYS_close (SYS_BASE + 6)
#define SYS_getpid (SYS_BASE + 20)
#define SYS_kill (SYS_BASE + 37)
+#define SYS_pipe (SYS_BASE + 42)
#define SYS_sigaltstack (SYS_BASE + 53)
#define SYS_munmap (SYS_BASE + 73)
#define SYS_madvise (SYS_BASE + 75)
@@ -40,6 +41,7 @@
#define SYS_thr_new (SYS_BASE + 455)
#define SYS_mmap (SYS_BASE + 477)
#define SYS_cpuset_getaffinity (SYS_BASE + 487)
+#define SYS_pipe2 (SYS_BASE + 542)
TEXT runtime·sys_umtx_op(SB),NOSPLIT,$0
MOVW addr+0(FP), R0
@@ -119,6 +121,32 @@ TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0
MOVW R0, ret+12(FP)
RET
+// func pipe() (r, w int32, errno int32)
+TEXT runtime·pipe(SB),NOSPLIT,$0-12
+ MOVW $SYS_pipe, R7
+ SWI $0
+ BCC ok
+ MOVW $0, R1
+ MOVW R1, r+0(FP)
+ MOVW R1, w+4(FP)
+ MOVW R0, errno+8(FP)
+ RET
+ok:
+ MOVW R0, r+0(FP)
+ MOVW R1, w+4(FP)
+ MOVW $0, R1
+ MOVW R1, errno+8(FP)
+ RET
+
+// func pipe2(flags int32) (r, w int32, errno int32)
+TEXT runtime·pipe2(SB),NOSPLIT,$0-16
+ MOVW $r+4(FP), R0
+ MOVW flags+0(FP), R1
+ MOVW $SYS_pipe2, R7
+ SWI $0
+ MOVW R0, errno+12(FP)
+ RET
+
TEXT runtime·write1(SB),NOSPLIT|NOFRAME,$0
MOVW fd+0(FP), R0 // arg 1 fd
MOVW p+4(FP), R1 // arg 2 buf
@@ -371,6 +399,20 @@ TEXT runtime·closeonexec(SB),NOSPLIT,$0
SWI $0
RET
+// func runtime·setNonblock(fd int32)
+TEXT runtime·setNonblock(SB),NOSPLIT,$0-4
+ MOVW fd+0(FP), R0 // fd
+ MOVW $3, R1 // F_GETFL
+ MOVW $0, R2
+ MOVW $SYS_fcntl, R7
+ SWI $0
+ ORR $0x4, R0, R2 // O_NONBLOCK
+ MOVW fd+0(FP), R0 // fd
+ MOVW $4, R1 // F_SETFL
+ MOVW $SYS_fcntl, R7
+ SWI $0
+ RET
+
// TODO: this is only valid for ARMv7+
TEXT ·publicationBarrier(SB),NOSPLIT|NOFRAME,$0-0
B runtime·armPublicationBarrier(SB)