OLD | NEW |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // TODO(rsc): Rewrite all nn(SP) references into name+(nn-8)(FP) | |
6 // so that go vet can check that they are correct. | |
7 | |
8 #include "textflag.h" | 5 #include "textflag.h" |
9 | 6 |
10 // | 7 // |
11 // System call support for 386, NetBSD | 8 // System call support for 386, NetBSD |
12 // | 9 // |
13 | 10 |
14 // func Syscall(trap int32, a1, a2, a3 int32) (r1, r2, err int32); | 11 // Just jump to package syscall's implementation for all these functions. |
15 // func Syscall6(trap int32, a1, a2, a3, a4, a5, a6 int32) (r1, r2, err int32); | 12 // The runtime may know about them. |
16 // Trap # in AX, args on stack above caller pc. | |
17 | 13 |
18 TEXT ·Syscall(SB),NOSPLIT,$0-28 | 14 TEXT ·Syscall(SB),NOSPLIT,$0-28 |
19 » CALL» runtime·entersyscall(SB) | 15 » JMP» syscall·Syscall(SB) |
20 » MOVL» 4(SP), AX» // syscall entry | |
21 » // slide args down on top of system call number | |
22 » LEAL» » 8(SP), SI | |
23 » LEAL» » 4(SP), DI | |
24 » CLD | |
25 » MOVSL | |
26 » MOVSL | |
27 » MOVSL | |
28 » INT» $0x80 | |
29 » JAE» ok | |
30 » MOVL» $-1, 20(SP)» // r1 | |
31 » MOVL» $-1, 24(SP)» // r2 | |
32 » MOVL» AX, 28(SP)» » // errno | |
33 » CALL» runtime·exitsyscall(SB) | |
34 » RET | |
35 ok: | |
36 » MOVL» AX, 20(SP)» // r1 | |
37 » MOVL» DX, 24(SP)» // r2 | |
38 » MOVL» $0, 28(SP)» // errno | |
39 » CALL» runtime·exitsyscall(SB) | |
40 » RET | |
41 | 16 |
42 TEXT ·Syscall6(SB),NOSPLIT,$0-40 | 17 TEXT ·Syscall6(SB),NOSPLIT,$0-40 |
43 » CALL» runtime·entersyscall(SB) | 18 » JMP» syscall·Syscall6(SB) |
44 » MOVL» 4(SP), AX» // syscall entry | |
45 » // slide args down on top of system call number | |
46 » LEAL» » 8(SP), SI | |
47 » LEAL» » 4(SP), DI | |
48 » CLD | |
49 » MOVSL | |
50 » MOVSL | |
51 » MOVSL | |
52 » MOVSL | |
53 » MOVSL | |
54 » MOVSL | |
55 » INT» $0x80 | |
56 » JAE» ok6 | |
57 » MOVL» $-1, 32(SP)» // r1 | |
58 » MOVL» $-1, 36(SP)» // r2 | |
59 » MOVL» AX, 40(SP)» » // errno | |
60 » CALL» runtime·exitsyscall(SB) | |
61 » RET | |
62 ok6: | |
63 » MOVL» AX, 32(SP)» // r1 | |
64 » MOVL» DX, 36(SP)» // r2 | |
65 » MOVL» $0, 40(SP)» // errno | |
66 » CALL» runtime·exitsyscall(SB) | |
67 » RET | |
68 | 19 |
69 TEXT ·Syscall9(SB),NOSPLIT,$0-52 | 20 TEXT ·Syscall9(SB),NOSPLIT,$0-52 |
70 » CALL» runtime·entersyscall(SB) | 21 » JMP» syscall·Syscall9(SB) |
71 » MOVL» 4(SP), AX» // syscall entry | |
72 » // slide args down on top of system call number | |
73 » LEAL» » 8(SP), SI | |
74 » LEAL» » 4(SP), DI | |
75 » CLD | |
76 » MOVSL | |
77 » MOVSL | |
78 » MOVSL | |
79 » MOVSL | |
80 » MOVSL | |
81 » MOVSL | |
82 » MOVSL | |
83 » MOVSL | |
84 » MOVSL | |
85 » INT» $0x80 | |
86 » JAE» ok9 | |
87 » MOVL» $-1, 44(SP)» // r1 | |
88 » MOVL» $-1, 48(SP)» // r2 | |
89 » MOVL» AX, 52(SP)» » // errno | |
90 » CALL» runtime·exitsyscall(SB) | |
91 » RET | |
92 ok9: | |
93 » MOVL» AX, 44(SP)» // r1 | |
94 » MOVL» DX, 48(SP)» // r2 | |
95 » MOVL» $0, 52(SP)» // errno | |
96 » CALL» runtime·exitsyscall(SB) | |
97 » RET | |
98 | 22 |
99 TEXT ·RawSyscall(SB),NOSPLIT,$0-28 | 23 TEXT ·RawSyscall(SB),NOSPLIT,$0-28 |
100 » MOVL» 4(SP), AX» // syscall entry | 24 » JMP» syscall·RawSyscall(SB) |
101 » // slide args down on top of system call number | |
102 » LEAL» » 8(SP), SI | |
103 » LEAL» » 4(SP), DI | |
104 » CLD | |
105 » MOVSL | |
106 » MOVSL | |
107 » MOVSL | |
108 » INT» $0x80 | |
109 » JAE» ok1 | |
110 » MOVL» $-1, 20(SP)» // r1 | |
111 » MOVL» $-1, 24(SP)» // r2 | |
112 » MOVL» AX, 28(SP)» » // errno | |
113 » RET | |
114 ok1: | |
115 » MOVL» AX, 20(SP)» // r1 | |
116 » MOVL» DX, 24(SP)» // r2 | |
117 » MOVL» $0, 28(SP)» // errno | |
118 » RET | |
119 | 25 |
120 TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 | 26 TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 |
121 » MOVL» 4(SP), AX» // syscall entry | 27 » JMP» syscall·RawSyscall6(SB) |
122 » // slide args down on top of system call number | |
123 » LEAL» » 8(SP), SI | |
124 » LEAL» » 4(SP), DI | |
125 » CLD | |
126 » MOVSL | |
127 » MOVSL | |
128 » MOVSL | |
129 » MOVSL | |
130 » MOVSL | |
131 » MOVSL | |
132 » INT» $0x80 | |
133 » JAE» ok2 | |
134 » MOVL» $-1, 32(SP)» // r1 | |
135 » MOVL» $-1, 36(SP)» // r2 | |
136 » MOVL» AX, 40(SP)» » // errno | |
137 » RET | |
138 ok2: | |
139 » MOVL» AX, 32(SP)» // r1 | |
140 » MOVL» DX, 36(SP)» // r2 | |
141 » MOVL» $0, 40(SP)» // errno | |
142 » RET | |
OLD | NEW |