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