Skip to content

Commit 9e5cf93

Browse files
4a6f656cFiloSottile
authored andcommitted
[release-branch.go1.14-cmd] unix: provide linux/riscv64 assembly for syscalls
While the linux/riscv64 port is not yet upstream, most of the syscalls package already has linux/riscv64 support and this will make testing and development easier. Updates golang/go#27532 Change-Id: I6e505be55fdbb2942fb6e4f34c040e7b82809630 Reviewed-on: https://go-review.googlesource.com/c/sys/+/177799 Reviewed-by: Brad Fitzpatrick <[email protected]> (cherry picked from commit 4c3a928) Reviewed-on: https://go-review.googlesource.com/c/sys/+/217300 Run-TryBot: Filippo Valsorda <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent a43fa87 commit 9e5cf93

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

unix/asm_linux_riscv64.s

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Copyright 2019 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
// +build riscv64,!gccgo
6+
7+
#include "textflag.h"
8+
9+
//
10+
// System calls for linux/riscv64.
11+
//
12+
// Where available, just jump to package syscall's implementation of
13+
// these functions.
14+
15+
TEXT ·Syscall(SB),NOSPLIT,$0-56
16+
JMP syscall·Syscall(SB)
17+
18+
TEXT ·Syscall6(SB),NOSPLIT,$0-80
19+
JMP syscall·Syscall6(SB)
20+
21+
TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
22+
CALL runtime·entersyscall(SB)
23+
MOV a1+8(FP), A0
24+
MOV a2+16(FP), A1
25+
MOV a3+24(FP), A2
26+
MOV $0, A3
27+
MOV $0, A4
28+
MOV $0, A5
29+
MOV $0, A6
30+
MOV trap+0(FP), A7 // syscall entry
31+
ECALL
32+
MOV A0, r1+32(FP) // r1
33+
MOV A1, r2+40(FP) // r2
34+
CALL runtime·exitsyscall(SB)
35+
RET
36+
37+
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
38+
JMP syscall·RawSyscall(SB)
39+
40+
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
41+
JMP syscall·RawSyscall6(SB)
42+
43+
TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
44+
MOV a1+8(FP), A0
45+
MOV a2+16(FP), A1
46+
MOV a3+24(FP), A2
47+
MOV ZERO, A3
48+
MOV ZERO, A4
49+
MOV ZERO, A5
50+
MOV trap+0(FP), A7 // syscall entry
51+
ECALL
52+
MOV A0, r1+32(FP)
53+
MOV A1, r2+40(FP)
54+
RET

0 commit comments

Comments
 (0)