Commit bc919475 authored by Joel Sing's avatar Joel Sing

runtime: correct assembly for openbsd/arm64

Correct the pipe and pipe2 implementations by using the correct RSP offsets,
used to store and return the file descriptor array.

Fix setNonblock by using the correct immediate value for O_NONBLOCK and
replace EOR (exclusive OR) with ORR.

Also correct the write1 implementation, which has a uintptr value for the fd
argument.

Change-Id: Ibca77af44b649e8bb330ca54f9c36a7a8b0f9cea
Reviewed-on: https://go-review.googlesource.com/c/go/+/212765
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
parent 25a14b19
...@@ -65,7 +65,7 @@ TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0 ...@@ -65,7 +65,7 @@ TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0
// func pipe() (r, w int32, errno int32) // func pipe() (r, w int32, errno int32)
TEXT runtime·pipe(SB),NOSPLIT|NOFRAME,$0-12 TEXT runtime·pipe(SB),NOSPLIT|NOFRAME,$0-12
MOVD RSP, R0 MOVD $r+0(FP), R0
MOVW $0, R1 MOVW $0, R1
MOVD $101, R8 // sys_pipe2 MOVD $101, R8 // sys_pipe2
SVC SVC
...@@ -76,7 +76,7 @@ TEXT runtime·pipe(SB),NOSPLIT|NOFRAME,$0-12 ...@@ -76,7 +76,7 @@ TEXT runtime·pipe(SB),NOSPLIT|NOFRAME,$0-12
// func pipe2(flags int32) (r, w int32, errno int32) // func pipe2(flags int32) (r, w int32, errno int32)
TEXT runtime·pipe2(SB),NOSPLIT|NOFRAME,$0-20 TEXT runtime·pipe2(SB),NOSPLIT|NOFRAME,$0-20
ADD $8, RSP, R0 MOVD $r+8(FP), R0
MOVW flags+0(FP), R1 MOVW flags+0(FP), R1
MOVD $101, R8 // sys_pipe2 MOVD $101, R8 // sys_pipe2
SVC SVC
...@@ -86,7 +86,7 @@ TEXT runtime·pipe2(SB),NOSPLIT|NOFRAME,$0-20 ...@@ -86,7 +86,7 @@ TEXT runtime·pipe2(SB),NOSPLIT|NOFRAME,$0-20
RET RET
TEXT runtime·write1(SB),NOSPLIT|NOFRAME,$0 TEXT runtime·write1(SB),NOSPLIT|NOFRAME,$0
MOVW fd+0(FP), R0 // arg 1 - fd MOVD fd+0(FP), R0 // arg 1 - fd
MOVD p+8(FP), R1 // arg 2 - buf MOVD p+8(FP), R1 // arg 2 - buf
MOVW n+16(FP), R2 // arg 3 - nbyte MOVW n+16(FP), R2 // arg 3 - nbyte
MOVD $4, R8 // sys_write MOVD $4, R8 // sys_write
...@@ -428,8 +428,8 @@ TEXT runtime·setNonblock(SB),NOSPLIT|NOFRAME,$0-4 ...@@ -428,8 +428,8 @@ TEXT runtime·setNonblock(SB),NOSPLIT|NOFRAME,$0-4
MOVD $0, R2 // arg 3 MOVD $0, R2 // arg 3
MOVD $92, R8 // sys_fcntl MOVD $92, R8 // sys_fcntl
SVC SVC
MOVD $0x800, R2 // O_NONBLOCK MOVD $4, R2 // O_NONBLOCK
EOR R0, R2 // arg 3 - flags ORR R0, R2 // arg 3 - flags
MOVW fd+0(FP), R0 // arg 1 - fd MOVW fd+0(FP), R0 // arg 1 - fd
MOVD $4, R1 // arg 2 - cmd (F_SETFL) MOVD $4, R1 // arg 2 - cmd (F_SETFL)
MOVD $92, R8 // sys_fcntl MOVD $92, R8 // sys_fcntl
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment