Text file
src/syscall/asm_linux_mipsx.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 //go:build linux && (mips || mipsle)
6
7 #include "textflag.h"
8 #include "funcdata.h"
9
10 //
11 // System calls for mips, Linux
12 //
13
14 // func Syscall(trap uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr);
15 TEXT ·Syscall(SB),NOSPLIT,$0-28
16 JAL runtime·entersyscall(SB)
17 MOVW a1+4(FP), R4
18 MOVW a2+8(FP), R5
19 MOVW a3+12(FP), R6
20 MOVW R0, R7
21 MOVW trap+0(FP), R2 // syscall entry
22 SYSCALL
23 BEQ R7, ok
24 MOVW $-1, R1
25 MOVW R1, r1+16(FP) // r1
26 MOVW R0, r2+20(FP) // r2
27 MOVW R2, err+24(FP) // errno
28 JAL runtime·exitsyscall(SB)
29 RET
30 ok:
31 MOVW R2, r1+16(FP) // r1
32 MOVW R3, r2+20(FP) // r2
33 MOVW R0, err+24(FP) // errno
34 JAL runtime·exitsyscall(SB)
35 RET
36
37 // func Syscall6(trap trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr);
38 // 5th and 6th arg go at sp+16, sp+20.
39 // Note that frame size of 20 means that 24 bytes gets reserved on stack.
40 TEXT ·Syscall6(SB),NOSPLIT,$20-40
41 NO_LOCAL_POINTERS
42 JAL runtime·entersyscall(SB)
43 MOVW a1+4(FP), R4
44 MOVW a2+8(FP), R5
45 MOVW a3+12(FP), R6
46 MOVW a4+16(FP), R7
47 MOVW a5+20(FP), R8
48 MOVW a6+24(FP), R9
49 MOVW R8, 16(R29)
50 MOVW R9, 20(R29)
51 MOVW trap+0(FP), R2 // syscall entry
52 SYSCALL
53 BEQ R7, ok6
54 MOVW $-1, R1
55 MOVW R1, r1+28(FP) // r1
56 MOVW R0, r2+32(FP) // r2
57 MOVW R2, err+36(FP) // errno
58 JAL runtime·exitsyscall(SB)
59 RET
60 ok6:
61 MOVW R2, r1+28(FP) // r1
62 MOVW R3, r2+32(FP) // r2
63 MOVW R0, err+36(FP) // errno
64 JAL runtime·exitsyscall(SB)
65 RET
66
67 // func Syscall9(trap trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2, err uintptr);
68 // Actually Syscall8 but the rest of the code expects it to be named Syscall9.
69 TEXT ·Syscall9(SB),NOSPLIT,$28-52
70 NO_LOCAL_POINTERS
71 JAL runtime·entersyscall(SB)
72 MOVW a1+4(FP), R4
73 MOVW a2+8(FP), R5
74 MOVW a3+12(FP), R6
75 MOVW a4+16(FP), R7
76 MOVW a5+20(FP), R8
77 MOVW a6+24(FP), R9
78 MOVW a7+28(FP), R10
79 MOVW a8+32(FP), R11
80 MOVW R8, 16(R29)
81 MOVW R9, 20(R29)
82 MOVW R10, 24(R29)
83 MOVW R11, 28(R29)
84 MOVW trap+0(FP), R2 // syscall entry
85 SYSCALL
86 BEQ R7, ok9
87 MOVW $-1, R1
88 MOVW R1, r1+40(FP) // r1
89 MOVW R0, r2+44(FP) // r2
90 MOVW R2, err+48(FP) // errno
91 JAL runtime·exitsyscall(SB)
92 RET
93 ok9:
94 MOVW R2, r1+40(FP) // r1
95 MOVW R3, r2+44(FP) // r2
96 MOVW R0, err+48(FP) // errno
97 JAL runtime·exitsyscall(SB)
98 RET
99
100 TEXT ·RawSyscall(SB),NOSPLIT,$24-28
101 MOVW a1+4(FP), R4
102 MOVW a2+8(FP), R5
103 MOVW a3+12(FP), R6
104 MOVW trap+0(FP), R2 // syscall entry
105 SYSCALL
106 BEQ R7, ok1
107 MOVW $-1, R1
108 MOVW R1, r1+16(FP) // r1
109 MOVW R0, r2+20(FP) // r2
110 MOVW R2, err+24(FP) // errno
111 RET
112 ok1:
113 MOVW R2, r1+16(FP) // r1
114 MOVW R3, r2+20(FP) // r2
115 MOVW R0, err+24(FP) // errno
116 RET
117
118 TEXT ·RawSyscall6(SB),NOSPLIT,$20-40
119 MOVW a1+4(FP), R4
120 MOVW a2+8(FP), R5
121 MOVW a3+12(FP), R6
122 MOVW a4+16(FP), R7
123 MOVW a5+20(FP), R8
124 MOVW a6+24(FP), R9
125 MOVW R8, 16(R29)
126 MOVW R9, 20(R29)
127 MOVW trap+0(FP), R2 // syscall entry
128 SYSCALL
129 BEQ R7, ok2
130 MOVW $-1, R1
131 MOVW R1, r1+28(FP) // r1
132 MOVW R0, r2+32(FP) // r2
133 MOVW R2, err+36(FP) // errno
134 RET
135 ok2:
136 MOVW R2, r1+28(FP) // r1
137 MOVW R3, r2+32(FP) // r2
138 MOVW R0, err+36(FP) // errno
139 RET
140
141 // func rawVforkSyscall(trap, a1 uintptr) (r1, err uintptr)
142 TEXT ·rawVforkSyscall(SB),NOSPLIT|NOFRAME,$0-16
143 MOVW a1+4(FP), R4
144 MOVW R0, R5
145 MOVW R0, R6
146 MOVW trap+0(FP), R2 // syscall entry
147 SYSCALL
148 BEQ R7, ok
149 MOVW $-1, R1
150 MOVW R1, r1+8(FP) // r1
151 MOVW R2, err+12(FP) // errno
152 RET
153 ok:
154 MOVW R2, r1+8(FP) // r1
155 MOVW R0, err+12(FP) // errno
156 RET
157
158 TEXT ·rawSyscallNoError(SB),NOSPLIT,$20-24
159 MOVW a1+4(FP), R4
160 MOVW a2+8(FP), R5
161 MOVW a3+12(FP), R6
162 MOVW trap+0(FP), R2 // syscall entry
163 SYSCALL
164 MOVW R2, r1+16(FP) // r1
165 MOVW R3, r2+20(FP) // r2
166 RET
167
View as plain text