Text file
src/syscall/asm_netbsd_arm64.s
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 #include "textflag.h"
6
7 //
8 // System call support for ARM64, NetBSD
9 //
10
11 #define SYS_syscall 0
12
13 // func Syscall(trap uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr)
14 TEXT ·Syscall(SB),NOSPLIT,$0-56
15 BL runtime·entersyscall(SB)
16 MOVD trap+0(FP), R17
17 MOVD a1+8(FP), R0
18 MOVD a2+16(FP), R1
19 MOVD a3+24(FP), R2
20 SVC $SYS_syscall
21 BCC ok
22 MOVD $-1, R1
23 MOVD R1, r1+32(FP) // r1
24 MOVD ZR, r2+40(FP) // r2
25 MOVD R0, err+48(FP) // err
26 BL runtime·exitsyscall(SB)
27 RET
28 ok:
29 MOVD R0, r1+32(FP) // r1
30 MOVD R1, r2+40(FP) // r2
31 MOVD ZR, err+48(FP) // err
32 BL runtime·exitsyscall(SB)
33 RET
34
35 // func RawSyscall(trap uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr)
36 TEXT ·RawSyscall(SB),NOSPLIT,$0-56
37 MOVD trap+0(FP), R17 // syscall entry
38 MOVD a1+8(FP), R0
39 MOVD a2+16(FP), R1
40 MOVD a3+24(FP), R2
41 SVC $SYS_syscall
42 BCC ok
43 MOVD $-1, R1
44 MOVD R1, r1+32(FP) // r1
45 MOVD ZR, r2+40(FP) // r2
46 MOVD R0, err+48(FP) // err
47 RET
48 ok:
49 MOVD R0, r1+32(FP) // r1
50 MOVD R1, r2+40(FP) // r2
51 MOVD ZR, err+48(FP) // err
52 RET
53
54 // func Syscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
55 TEXT ·Syscall6(SB),NOSPLIT,$0-80
56 BL runtime·entersyscall(SB)
57 MOVD trap+0(FP), R17 // syscall entry
58 MOVD a1+8(FP), R0
59 MOVD a2+16(FP), R1
60 MOVD a3+24(FP), R2
61 MOVD a4+32(FP), R3
62 MOVD a5+40(FP), R4
63 MOVD a6+48(FP), R5
64 SVC $SYS_syscall
65 BCC ok
66 MOVD $-1, R1
67 MOVD R1, r1+56(FP) // r1
68 MOVD ZR, r2+64(FP) // r2
69 MOVD R0, err+72(FP) // err
70 BL runtime·exitsyscall(SB)
71 RET
72 ok:
73 MOVD R0, r1+56(FP) // r1
74 MOVD R1, r2+64(FP) // r2
75 MOVD ZR, err+72(FP) // err
76 BL runtime·exitsyscall(SB)
77 RET
78
79 // func RawSyscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
80 TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
81 MOVD trap+0(FP), R17 // syscall entry
82 MOVD a1+8(FP), R0
83 MOVD a2+16(FP), R1
84 MOVD a3+24(FP), R2
85 MOVD a4+32(FP), R3
86 MOVD a5+40(FP), R4
87 MOVD a6+48(FP), R5
88 SVC $SYS_syscall
89 BCC ok
90 MOVD $-1, R1
91 MOVD R1, r1+56(FP) // r1
92 MOVD ZR, r2+64(FP) // r2
93 MOVD R0, err+72(FP) // err
94 RET
95 ok:
96 MOVD R0, r1+56(FP) // r1
97 MOVD R1, r2+64(FP) // r2
98 MOVD ZR, R0
99 MOVD R0, err+72(FP) // err
100 RET
101
102 // Actually Syscall7
103 TEXT ·Syscall9(SB),NOSPLIT,$0-104
104 BL runtime·entersyscall(SB)
105 MOVD num+0(FP), R17 // syscall entry
106 MOVD a1+8(FP), R0
107 MOVD a2+16(FP), R1
108 MOVD a3+24(FP), R2
109 MOVD a4+32(FP), R3
110 MOVD a5+40(FP), R4
111 MOVD a6+48(FP), R5
112 MOVD a7+56(FP), R6
113 //MOVD a8+64(FP), R7
114 //MOVD a9+72(FP), R8
115 SVC $SYS_syscall
116 BCC ok
117 MOVD $-1, R1
118 MOVD R1, r1+80(FP) // r1
119 MOVD ZR, r2+88(FP) // r2
120 MOVD R0, err+96(FP) // err
121 BL runtime·exitsyscall(SB)
122 RET
123 ok:
124 MOVD R0, r1+80(FP) // r1
125 MOVD R1, r2+88(FP) // r2
126 MOVD ZR, err+96(FP) // err
127 BL runtime·exitsyscall(SB)
128 RET
129
130
View as plain text