Text file
src/syscall/asm_linux_s390x.s
1 // Copyright 2016 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 calls for s390x, Linux
9 //
10
11 // func Syscall(trap int64, a1, a2, a3 int64) (r1, r2, err int64)
12 TEXT ·Syscall(SB),NOSPLIT,$0-56
13 BL runtime·entersyscall(SB)
14 MOVD a1+8(FP), R2
15 MOVD a2+16(FP), R3
16 MOVD a3+24(FP), R4
17 MOVD $0, R5
18 MOVD $0, R6
19 MOVD $0, R7
20 MOVD trap+0(FP), R1 // syscall entry
21 SYSCALL
22 MOVD $0xfffffffffffff001, R8
23 CMPUBLT R2, R8, ok
24 MOVD $-1, r1+32(FP)
25 MOVD $0, r2+40(FP)
26 NEG R2, R2
27 MOVD R2, err+48(FP) // errno
28 BL runtime·exitsyscall(SB)
29 RET
30 ok:
31 MOVD R2, r1+32(FP)
32 MOVD R3, r2+40(FP)
33 MOVD $0, err+48(FP) // errno
34 BL runtime·exitsyscall(SB)
35 RET
36
37 // func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
38 TEXT ·Syscall6(SB),NOSPLIT,$0-80
39 BL runtime·entersyscall(SB)
40 MOVD a1+8(FP), R2
41 MOVD a2+16(FP), R3
42 MOVD a3+24(FP), R4
43 MOVD a4+32(FP), R5
44 MOVD a5+40(FP), R6
45 MOVD a6+48(FP), R7
46 MOVD trap+0(FP), R1 // syscall entry
47 SYSCALL
48 MOVD $0xfffffffffffff001, R8
49 CMPUBLT R2, R8, ok6
50 MOVD $-1, r1+56(FP)
51 MOVD $0, r2+64(FP)
52 NEG R2, R2
53 MOVD R2, err+72(FP) // errno
54 BL runtime·exitsyscall(SB)
55 RET
56 ok6:
57 MOVD R2, r1+56(FP)
58 MOVD R3, r2+64(FP)
59 MOVD $0, err+72(FP) // errno
60 BL runtime·exitsyscall(SB)
61 RET
62
63 // func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
64 TEXT ·RawSyscall(SB),NOSPLIT,$0-56
65 MOVD a1+8(FP), R2
66 MOVD a2+16(FP), R3
67 MOVD a3+24(FP), R4
68 MOVD $0, R5
69 MOVD $0, R6
70 MOVD $0, R7
71 MOVD trap+0(FP), R1 // syscall entry
72 SYSCALL
73 MOVD $0xfffffffffffff001, R8
74 CMPUBLT R2, R8, ok1
75 MOVD $-1, r1+32(FP)
76 MOVD $0, r2+40(FP)
77 NEG R2, R2
78 MOVD R2, err+48(FP) // errno
79 RET
80 ok1:
81 MOVD R2, r1+32(FP)
82 MOVD R3, r2+40(FP)
83 MOVD $0, err+48(FP) // errno
84 RET
85
86 // func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
87 TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
88 MOVD a1+8(FP), R2
89 MOVD a2+16(FP), R3
90 MOVD a3+24(FP), R4
91 MOVD a4+32(FP), R5
92 MOVD a5+40(FP), R6
93 MOVD a6+48(FP), R7
94 MOVD trap+0(FP), R1 // syscall entry
95 SYSCALL
96 MOVD $0xfffffffffffff001, R8
97 CMPUBLT R2, R8, ok2
98 MOVD $-1, r1+56(FP)
99 MOVD $0, r2+64(FP)
100 NEG R2, R2
101 MOVD R2, err+72(FP) // errno
102 RET
103 ok2:
104 MOVD R2, r1+56(FP)
105 MOVD R3, r2+64(FP)
106 MOVD $0, err+72(FP) // errno
107 RET
108
109 // func rawVforkSyscall(trap, a1 uintptr) (r1, err uintptr)
110 TEXT ·rawVforkSyscall(SB),NOSPLIT|NOFRAME,$0-32
111 MOVD $0, R2
112 MOVD a1+8(FP), R3
113 MOVD $0, R4
114 MOVD $0, R5
115 MOVD $0, R6
116 MOVD $0, R7
117 MOVD trap+0(FP), R1 // syscall entry
118 SYSCALL
119 MOVD $0xfffffffffffff001, R8
120 CMPUBLT R2, R8, ok2
121 MOVD $-1, r1+16(FP)
122 NEG R2, R2
123 MOVD R2, err+24(FP) // errno
124 RET
125 ok2:
126 MOVD R2, r1+16(FP)
127 MOVD $0, err+24(FP) // errno
128 RET
129
130 // func rawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr)
131 TEXT ·rawSyscallNoError(SB),NOSPLIT,$0-48
132 MOVD a1+8(FP), R2
133 MOVD a2+16(FP), R3
134 MOVD a3+24(FP), R4
135 MOVD $0, R5
136 MOVD $0, R6
137 MOVD $0, R7
138 MOVD trap+0(FP), R1 // syscall entry
139 SYSCALL
140 MOVD R2, r1+32(FP)
141 MOVD R3, r2+40(FP)
142 RET
143
144 #define SYS_SOCKETCALL 102 /* from zsysnum_linux_s390x.go */
145
146 // func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err int)
147 // Kernel interface gets call sub-number and pointer to a0.
148 TEXT ·socketcall(SB),NOSPLIT,$0-72
149 BL runtime·entersyscall(SB)
150 MOVD $SYS_SOCKETCALL, R1 // syscall entry
151 MOVD call+0(FP), R2 // socket call number
152 MOVD $a0+8(FP), R3 // pointer to call arguments
153 MOVD $0, R4
154 MOVD $0, R5
155 MOVD $0, R6
156 MOVD $0, R7
157 SYSCALL
158 MOVD $0xfffffffffffff001, R8
159 CMPUBLT R2, R8, oksock
160 MOVD $-1, n+56(FP)
161 NEG R2, R2
162 MOVD R2, err+64(FP)
163 BL runtime·exitsyscall(SB)
164 RET
165 oksock:
166 MOVD R2, n+56(FP)
167 MOVD $0, err+64(FP)
168 CALL runtime·exitsyscall(SB)
169 RET
170
171 // func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err int)
172 // Kernel interface gets call sub-number and pointer to a0.
173 TEXT ·rawsocketcall(SB),NOSPLIT,$0-72
174 MOVD $SYS_SOCKETCALL, R1 // syscall entry
175 MOVD call+0(FP), R2 // socket call number
176 MOVD $a0+8(FP), R3 // pointer to call arguments
177 MOVD $0, R4
178 MOVD $0, R5
179 MOVD $0, R6
180 MOVD $0, R7
181 SYSCALL
182 MOVD $0xfffffffffffff001, R8
183 CMPUBLT R2, R8, oksock1
184 MOVD $-1, n+56(FP)
185 NEG R2, R2
186 MOVD R2, err+64(FP)
187 RET
188 oksock1:
189 MOVD R2, n+56(FP)
190 MOVD $0, err+64(FP)
191 RET
192
View as plain text