Text file
src/syscall/asm_freebsd_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, FreeBSD
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<ABIInternal>(SB)
16 MOVD trap+0(FP), R8 // syscall entry
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)
24 MOVD ZR, r2+40(FP)
25 MOVD R0, err+48(FP)
26 BL runtime·exitsyscall<ABIInternal>(SB)
27 RET
28 ok:
29 MOVD R0, r1+32(FP)
30 MOVD R1, r2+40(FP)
31 MOVD ZR, err+48(FP)
32 BL runtime·exitsyscall<ABIInternal>(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), R8 // 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)
45 MOVD ZR, r2+40(FP)
46 MOVD R0, err+48(FP)
47 RET
48 ok:
49 MOVD R0, r1+32(FP)
50 MOVD R1, r2+40(FP)
51 MOVD ZR, err+48(FP)
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<ABIInternal>(SB)
57 MOVD trap+0(FP), R8 // 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)
68 MOVD ZR, r2+64(FP)
69 MOVD R0, err+72(FP)
70 BL runtime·exitsyscall<ABIInternal>(SB)
71 RET
72 ok:
73 MOVD R0, r1+56(FP)
74 MOVD R1, r2+64(FP)
75 MOVD ZR, err+72(FP)
76 BL runtime·exitsyscall<ABIInternal>(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), R8 // 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)
92 MOVD ZR, r2+64(FP)
93 MOVD R0, err+72(FP)
94 RET
95 ok:
96 MOVD R0, r1+56(FP)
97 MOVD R1, r2+64(FP)
98 MOVD ZR, err+72(FP)
99 RET
100
101 // Actually Syscall7
102 // func Syscall9(num uintptr, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2, err uintptr)
103 TEXT ·Syscall9(SB),NOSPLIT,$0-104
104 BL runtime·entersyscall<ABIInternal>(SB)
105 MOVD num+0(FP), R8 // 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)
119 MOVD ZR, r2+88(FP)
120 MOVD R0, err+96(FP)
121 BL runtime·exitsyscall<ABIInternal>(SB)
122 RET
123 ok:
124 MOVD R0, r1+80(FP)
125 MOVD R1, r2+88(FP)
126 MOVD ZR, err+96(FP)
127 BL runtime·exitsyscall<ABIInternal>(SB)
128 RET
129
View as plain text