aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/internal/syscall
diff options
context:
space:
mode:
authorWayne Zuo <wdvxdr@golangcn.org>2022-10-17 23:01:13 +0800
committerGopher Robot <gobot@golang.org>2022-10-26 05:51:33 +0000
commit939f9fd64a740ef770a0ca3588f8c193dceebe83 (patch)
treeceabde1e60f4f17637e5980526fee1fe4901f8b6 /src/runtime/internal/syscall
parentd2901205c15d5d839c95988497c190b652c5cf3a (diff)
downloadgo-939f9fd64a740ef770a0ca3588f8c193dceebe83.tar.xz
runtime/internal/syscall: use ABIInternal for Syscall6 on riscv64
Change-Id: Iceed0f55038c87f261b60309e025132142946364 Reviewed-on: https://go-review.googlesource.com/c/go/+/443557 Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org> Reviewed-by: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Wayne Zuo <wdvxdr@golangcn.org>
Diffstat (limited to 'src/runtime/internal/syscall')
-rw-r--r--src/runtime/internal/syscall/asm_linux_riscv64.s46
1 files changed, 30 insertions, 16 deletions
diff --git a/src/runtime/internal/syscall/asm_linux_riscv64.s b/src/runtime/internal/syscall/asm_linux_riscv64.s
index a8652fdd6b..15e50ec153 100644
--- a/src/runtime/internal/syscall/asm_linux_riscv64.s
+++ b/src/runtime/internal/syscall/asm_linux_riscv64.s
@@ -5,25 +5,39 @@
#include "textflag.h"
// func Syscall6(num, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, errno uintptr)
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- MOV num+0(FP), A7 // syscall entry
- MOV a1+8(FP), A0
- MOV a2+16(FP), A1
- MOV a3+24(FP), A2
- MOV a4+32(FP), A3
- MOV a5+40(FP), A4
- MOV a6+48(FP), A5
+//
+// We need to convert to the syscall ABI.
+//
+// arg | ABIInternal | Syscall
+// ---------------------------
+// num | A0 | A7
+// a1 | A1 | A0
+// a2 | A2 | A1
+// a3 | A3 | A2
+// a4 | A4 | A3
+// a5 | A5 | A4
+// a6 | A6 | A5
+//
+// r1 | A0 | A0
+// r2 | A1 | A1
+// err | A2 | part of A0
+TEXT ·Syscall6<ABIInternal>(SB),NOSPLIT,$0-80
+ MOV A0, A7
+ MOV A1, A0
+ MOV A2, A1
+ MOV A3, A2
+ MOV A4, A3
+ MOV A5, A4
+ MOV A6, A5
ECALL
MOV $-4096, T0
BLTU T0, A0, err
- MOV A0, r1+56(FP)
- MOV A1, r2+64(FP)
- MOV ZERO, errno+72(FP)
+ // r1 already in A0
+ // r2 already in A1
+ MOV ZERO, A2 // errno
RET
err:
- MOV $-1, T0
- MOV T0, r1+56(FP)
- MOV ZERO, r2+64(FP)
- SUB A0, ZERO, A0
- MOV A0, errno+72(FP)
+ SUB A0, ZERO, A2 // errno
+ MOV $-1, A0 // r1
+ MOV ZERO, A1 // r2
RET