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