blob: 65f8c1a6eeef3a8a6a0bb1a5cab1affa365f8595 [file] [log] [blame]
Devon H. O'Dell0489a262009-11-17 08:20:58 -08001// Copyright 2009 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// System calls and other sys.stuff for AMD64, FreeBSD
6// /usr/src/sys/kern/syscalls.master for syscall numbers.
7//
8
Russ Cox55889402011-12-19 15:51:13 -05009#include "zasm_GOOS_GOARCH.h"
Russ Coxcb040d52014-09-04 23:05:18 -040010#include "textflag.h"
Russ Cox555da732013-09-16 14:04:32 -040011
12// FreeBSD 8, FreeBSD 9, and older versions that I have checked
13// do not restore R10 on exit from a "restarted" system call
14// if you use the SYSCALL instruction. This means that, for example,
15// if a signal arrives while the wait4 system call is executing,
16// the wait4 internally returns ERESTART, which makes the kernel
17// back up the PC to execute the SYSCALL instruction a second time.
18// However, since the kernel does not restore R10, the fourth
19// argument to the system call has been lost. (FreeBSD 9 also fails
20// to restore the fifth and sixth arguments, R8 and R9, although
21// some earlier versions did restore those correctly.)
22// The broken code is in fast_syscall in FreeBSD's amd64/amd64/exception.S.
23// It restores only DI, SI, DX, AX, and RFLAGS on system call return.
24// http://fxr.watson.org/fxr/source/amd64/amd64/exception.S?v=FREEBSD91#L399
25//
26// The INT $0x80 system call path (int0x80_syscall in FreeBSD's
27// amd64/ia32/ia32_exception.S) does not have this problem,
28// but it expects the third argument in R10. Instead of rewriting
29// all the assembly in this file, #define SYSCALL to a safe simulation
30// using INT $0x80.
Russ Coxa70cbf12013-09-16 14:22:24 -040031//
Russ Cox555da732013-09-16 14:04:32 -040032// INT $0x80 is a little slower than SYSCALL, but correctness wins.
33//
34// See golang.org/issue/6372.
35#define SYSCALL MOVQ R10, CX; INT $0x80
Devon H. O'Dell0489a262009-11-17 08:20:58 -080036
Keith Randall0273dc12013-08-07 12:20:05 -070037TEXT runtime·sys_umtx_op(SB),NOSPLIT,$0
Russ Cox25f6b022014-08-27 11:32:17 -040038 MOVQ addr+0(FP), DI
39 MOVL mode+8(FP), SI
40 MOVL val+12(FP), DX
41 MOVQ ptr2+16(FP), R10
42 MOVQ ts+24(FP), R8
Devon H. O'Dell0489a262009-11-17 08:20:58 -080043 MOVL $454, AX
44 SYSCALL
Russ Cox25f6b022014-08-27 11:32:17 -040045 MOVL AX, ret+32(FP)
Devon H. O'Dell0489a262009-11-17 08:20:58 -080046 RET
47
Keith Randall0273dc12013-08-07 12:20:05 -070048TEXT runtime·thr_new(SB),NOSPLIT,$0
Russ Cox25f6b022014-08-27 11:32:17 -040049 MOVQ param+0(FP), DI
50 MOVL size+8(FP), SI
Devon H. O'Dell0489a262009-11-17 08:20:58 -080051 MOVL $455, AX
52 SYSCALL
53 RET
54
Keith Randall0273dc12013-08-07 12:20:05 -070055TEXT runtime·thr_start(SB),NOSPLIT,$0
Devon H. O'Dellb0891062012-02-22 15:44:09 +110056 MOVQ DI, R13 // m
Russ Coxe473f422010-08-04 17:50:22 -070057
58 // set up FS to point at m->tls
59 LEAQ m_tls(R13), DI
Russ Cox68b42552010-11-04 14:00:19 -040060 CALL runtime·settls(SB) // smashes DI
Russ Coxe473f422010-08-04 17:50:22 -070061
62 // set up m, g
63 get_tls(CX)
Russ Coxe473f422010-08-04 17:50:22 -070064 MOVQ m_g0(R13), DI
Russ Cox89f185f2014-06-26 11:54:39 -040065 MOVQ R13, g_m(DI)
Russ Coxe473f422010-08-04 17:50:22 -070066 MOVQ DI, g(CX)
67
Russ Coxe6a3e222013-03-01 11:44:43 -050068 CALL runtime·stackcheck(SB)
69 CALL runtime·mstart(SB)
Russ Coxc5f694a2013-03-01 08:30:11 -050070
Devon H. O'Dell0489a262009-11-17 08:20:58 -080071 MOVQ 0, AX // crash (not reached)
72
Devon H. O'Dell0489a262009-11-17 08:20:58 -080073// Exit the entire program (like C exit)
Keith Randall0273dc12013-08-07 12:20:05 -070074TEXT runtime·exit(SB),NOSPLIT,$-8
Russ Cox25f6b022014-08-27 11:32:17 -040075 MOVL code+0(FP), DI // arg 1 exit status
Devon H. O'Dell0489a262009-11-17 08:20:58 -080076 MOVL $1, AX
77 SYSCALL
Russ Cox36aa7d42012-03-08 14:03:56 -050078 MOVL $0xf1, 0xf1 // crash
Devon H. O'Dell0489a262009-11-17 08:20:58 -080079 RET
80
Keith Randall0273dc12013-08-07 12:20:05 -070081TEXT runtime·exit1(SB),NOSPLIT,$-8
Russ Cox25f6b022014-08-27 11:32:17 -040082 MOVL code+0(FP), DI // arg 1 exit status
Devon H. O'Dell0489a262009-11-17 08:20:58 -080083 MOVL $431, AX
84 SYSCALL
Russ Cox36aa7d42012-03-08 14:03:56 -050085 MOVL $0xf1, 0xf1 // crash
Devon H. O'Dell0489a262009-11-17 08:20:58 -080086 RET
87
Keith Randall0273dc12013-08-07 12:20:05 -070088TEXT runtime·open(SB),NOSPLIT,$-8
Russ Cox25f6b022014-08-27 11:32:17 -040089 MOVQ name+0(FP), DI // arg 1 pathname
90 MOVL mode+8(FP), SI // arg 2 flags
91 MOVL perm+12(FP), DX // arg 3 mode
Keith Randalla5d40242013-03-12 10:47:44 -070092 MOVL $5, AX
93 SYSCALL
Russ Cox25f6b022014-08-27 11:32:17 -040094 MOVL AX, ret+16(FP)
Keith Randalla5d40242013-03-12 10:47:44 -070095 RET
96
Keith Randall0273dc12013-08-07 12:20:05 -070097TEXT runtime·close(SB),NOSPLIT,$-8
Russ Cox25f6b022014-08-27 11:32:17 -040098 MOVL fd+0(FP), DI // arg 1 fd
Keith Randalla5d40242013-03-12 10:47:44 -070099 MOVL $6, AX
100 SYSCALL
Russ Cox25f6b022014-08-27 11:32:17 -0400101 MOVL AX, ret+8(FP)
Keith Randalla5d40242013-03-12 10:47:44 -0700102 RET
103
Keith Randall0273dc12013-08-07 12:20:05 -0700104TEXT runtime·read(SB),NOSPLIT,$-8
Russ Cox25f6b022014-08-27 11:32:17 -0400105 MOVL fd+0(FP), DI // arg 1 fd
106 MOVQ p+8(FP), SI // arg 2 buf
107 MOVL n+16(FP), DX // arg 3 count
Keith Randalla5d40242013-03-12 10:47:44 -0700108 MOVL $3, AX
109 SYSCALL
Russ Cox25f6b022014-08-27 11:32:17 -0400110 MOVL AX, ret+24(FP)
Keith Randalla5d40242013-03-12 10:47:44 -0700111 RET
112
Keith Randall0273dc12013-08-07 12:20:05 -0700113TEXT runtime·write(SB),NOSPLIT,$-8
Russ Cox25f6b022014-08-27 11:32:17 -0400114 MOVQ fd+0(FP), DI // arg 1 fd
115 MOVQ p+8(FP), SI // arg 2 buf
116 MOVL n+16(FP), DX // arg 3 count
Devon H. O'Dell0489a262009-11-17 08:20:58 -0800117 MOVL $4, AX
118 SYSCALL
Russ Cox25f6b022014-08-27 11:32:17 -0400119 MOVL AX, ret+24(FP)
Devon H. O'Dell0489a262009-11-17 08:20:58 -0800120 RET
121
Keith Randall0273dc12013-08-07 12:20:05 -0700122TEXT runtime·getrlimit(SB),NOSPLIT,$-8
Russ Cox25f6b022014-08-27 11:32:17 -0400123 MOVL kind+0(FP), DI
124 MOVQ limit+8(FP), SI
Russ Cox102274a2012-02-24 15:28:51 -0500125 MOVL $194, AX
126 SYSCALL
Russ Cox25f6b022014-08-27 11:32:17 -0400127 MOVL AX, ret+16(FP)
Russ Cox102274a2012-02-24 15:28:51 -0500128 RET
129
Keith Randall0273dc12013-08-07 12:20:05 -0700130TEXT runtime·raise(SB),NOSPLIT,$16
Russ Cox8698bb62011-04-25 16:58:00 -0400131 // thr_self(&8(SP))
132 LEAQ 8(SP), DI // arg 1 &8(SP)
133 MOVL $432, AX
134 SYSCALL
135 // thr_kill(self, SIGPIPE)
136 MOVQ 8(SP), DI // arg 1 id
Russ Cox5146a932013-03-15 01:11:03 -0400137 MOVL sig+0(FP), SI // arg 2
Russ Cox8698bb62011-04-25 16:58:00 -0400138 MOVL $433, AX
139 SYSCALL
140 RET
141
Keith Randall0273dc12013-08-07 12:20:05 -0700142TEXT runtime·setitimer(SB), NOSPLIT, $-8
Russ Cox25f6b022014-08-27 11:32:17 -0400143 MOVL mode+0(FP), DI
144 MOVQ new+8(FP), SI
145 MOVQ old+16(FP), DX
Russ Cox8dee8722011-03-23 11:31:42 -0400146 MOVL $83, AX
147 SYSCALL
148 RET
149
Russ Coxefe3d352011-11-30 11:59:44 -0500150// func now() (sec int64, nsec int32)
Keith Randall0273dc12013-08-07 12:20:05 -0700151TEXT time·now(SB), NOSPLIT, $32
Shenghou Ma7777bac2012-12-18 22:57:25 +0800152 MOVL $232, AX
Mikio Hara36013e42014-02-26 10:19:51 +0900153 MOVQ $0, DI // CLOCK_REALTIME
Shenghou Ma7777bac2012-12-18 22:57:25 +0800154 LEAQ 8(SP), SI
Russ Coxefe3d352011-11-30 11:59:44 -0500155 SYSCALL
156 MOVQ 8(SP), AX // sec
Shenghou Ma7777bac2012-12-18 22:57:25 +0800157 MOVQ 16(SP), DX // nsec
Russ Coxefe3d352011-11-30 11:59:44 -0500158
Shenghou Ma7777bac2012-12-18 22:57:25 +0800159 // sec is in AX, nsec in DX
Russ Coxefe3d352011-11-30 11:59:44 -0500160 MOVQ AX, sec+0(FP)
Russ Coxefe3d352011-11-30 11:59:44 -0500161 MOVL DX, nsec+8(FP)
162 RET
163
Keith Randall0273dc12013-08-07 12:20:05 -0700164TEXT runtime·nanotime(SB), NOSPLIT, $32
Shenghou Ma7777bac2012-12-18 22:57:25 +0800165 MOVL $232, AX
Mikio Hara36013e42014-02-26 10:19:51 +0900166 // We can use CLOCK_MONOTONIC_FAST here when we drop
167 // support for FreeBSD 8-STABLE.
168 MOVQ $4, DI // CLOCK_MONOTONIC
Shenghou Ma7777bac2012-12-18 22:57:25 +0800169 LEAQ 8(SP), SI
Russ Coxe4f06812010-02-08 14:32:22 -0800170 SYSCALL
Russ Coxf4373312011-11-03 17:35:28 -0400171 MOVQ 8(SP), AX // sec
Shenghou Ma7777bac2012-12-18 22:57:25 +0800172 MOVQ 16(SP), DX // nsec
Russ Coxe4f06812010-02-08 14:32:22 -0800173
Shenghou Ma7777bac2012-12-18 22:57:25 +0800174 // sec is in AX, nsec in DX
Russ Coxf4373312011-11-03 17:35:28 -0400175 // return nsec in AX
176 IMULQ $1000000000, AX
Russ Coxf4373312011-11-03 17:35:28 -0400177 ADDQ DX, AX
Russ Cox25f6b022014-08-27 11:32:17 -0400178 MOVQ AX, ret+0(FP)
Russ Coxe4f06812010-02-08 14:32:22 -0800179 RET
180
Keith Randall0273dc12013-08-07 12:20:05 -0700181TEXT runtime·sigaction(SB),NOSPLIT,$-8
Russ Cox25f6b022014-08-27 11:32:17 -0400182 MOVL sig+0(FP), DI // arg 1 sig
183 MOVQ new+8(FP), SI // arg 2 act
184 MOVQ old+16(FP), DX // arg 3 oact
Devon H. O'Dell0489a262009-11-17 08:20:58 -0800185 MOVL $416, AX
186 SYSCALL
187 JCC 2(PC)
Russ Cox36aa7d42012-03-08 14:03:56 -0500188 MOVL $0xf1, 0xf1 // crash
Devon H. O'Dell0489a262009-11-17 08:20:58 -0800189 RET
190
Keith Randall0273dc12013-08-07 12:20:05 -0700191TEXT runtime·sigtramp(SB),NOSPLIT,$64
Russ Cox690291a2011-02-23 14:47:42 -0500192 get_tls(BX)
Shenghou Ma2f1ead72013-07-12 04:39:39 +0800193
Russ Cox89f185f2014-06-26 11:54:39 -0400194 // check that g exists
195 MOVQ g(BX), R10
196 CMPQ R10, $0
Shenghou Ma2f1ead72013-07-12 04:39:39 +0800197 JNE 5(PC)
Alan Donovan532dee32012-09-04 14:40:49 -0400198 MOVQ DI, 0(SP)
Shenghou Ma2f1ead72013-07-12 04:39:39 +0800199 MOVQ $runtime·badsignal(SB), AX
200 CALL AX
Alan Donovan532dee32012-09-04 14:40:49 -0400201 RET
Russ Coxb2369112012-03-12 15:55:18 -0400202
Russ Cox690291a2011-02-23 14:47:42 -0500203 // save g
Russ Cox690291a2011-02-23 14:47:42 -0500204 MOVQ R10, 40(SP)
205
206 // g = m->signal
Russ Cox89f185f2014-06-26 11:54:39 -0400207 MOVQ g_m(R10), BP
Russ Cox690291a2011-02-23 14:47:42 -0500208 MOVQ m_gsignal(BP), BP
209 MOVQ BP, g(BX)
210
Devon H. O'Dell0489a262009-11-17 08:20:58 -0800211 MOVQ DI, 0(SP)
212 MOVQ SI, 8(SP)
213 MOVQ DX, 16(SP)
Russ Cox690291a2011-02-23 14:47:42 -0500214 MOVQ R10, 24(SP)
Shenghou Ma2f1ead72013-07-12 04:39:39 +0800215
Russ Cox68b42552010-11-04 14:00:19 -0400216 CALL runtime·sighandler(SB)
Russ Cox690291a2011-02-23 14:47:42 -0500217
218 // restore g
219 get_tls(BX)
220 MOVQ 40(SP), R10
221 MOVQ R10, g(BX)
Devon H. O'Dell0489a262009-11-17 08:20:58 -0800222 RET
223
Keith Randall0273dc12013-08-07 12:20:05 -0700224TEXT runtime·mmap(SB),NOSPLIT,$0
Russ Cox25f6b022014-08-27 11:32:17 -0400225 MOVQ addr+0(FP), DI // arg 1 addr
226 MOVQ n+8(FP), SI // arg 2 len
227 MOVL prot+16(FP), DX // arg 3 prot
228 MOVL flags+20(FP), R10 // arg 4 flags
229 MOVL fd+24(FP), R8 // arg 5 fid
230 MOVL off+28(FP), R9 // arg 6 offset
Devon H. O'Dell0489a262009-11-17 08:20:58 -0800231 MOVL $477, AX
232 SYSCALL
Russ Cox25f6b022014-08-27 11:32:17 -0400233 MOVQ AX, ret+32(FP)
Devon H. O'Dell0489a262009-11-17 08:20:58 -0800234 RET
235
Keith Randall0273dc12013-08-07 12:20:05 -0700236TEXT runtime·munmap(SB),NOSPLIT,$0
Russ Cox25f6b022014-08-27 11:32:17 -0400237 MOVQ addr+0(FP), DI // arg 1 addr
238 MOVQ n+8(FP), SI // arg 2 len
Russ Coxd4cc5572010-09-07 09:57:22 -0400239 MOVL $73, AX
240 SYSCALL
241 JCC 2(PC)
Russ Cox36aa7d42012-03-08 14:03:56 -0500242 MOVL $0xf1, 0xf1 // crash
Devon H. O'Dell0489a262009-11-17 08:20:58 -0800243 RET
244
Keith Randall0273dc12013-08-07 12:20:05 -0700245TEXT runtime·madvise(SB),NOSPLIT,$0
Russ Cox25f6b022014-08-27 11:32:17 -0400246 MOVQ addr+0(FP), DI
247 MOVQ n+8(FP), SI
248 MOVL flags+16(FP), DX
John Graham-Cumming314fd622012-11-24 15:55:19 +1100249 MOVQ $75, AX // madvise
250 SYSCALL
Russ Cox295a4d82012-12-22 15:06:28 -0500251 // ignore failure - maybe pages are locked
John Graham-Cumming314fd622012-11-24 15:55:19 +1100252 RET
253
Keith Randall0273dc12013-08-07 12:20:05 -0700254TEXT runtime·sigaltstack(SB),NOSPLIT,$-8
Devon H. O'Dell0489a262009-11-17 08:20:58 -0800255 MOVQ new+8(SP), DI
256 MOVQ old+16(SP), SI
257 MOVQ $53, AX
258 SYSCALL
259 JCC 2(PC)
Russ Cox36aa7d42012-03-08 14:03:56 -0500260 MOVL $0xf1, 0xf1 // crash
Devon H. O'Dell0489a262009-11-17 08:20:58 -0800261 RET
Russ Coxe473f422010-08-04 17:50:22 -0700262
Keith Randall0273dc12013-08-07 12:20:05 -0700263TEXT runtime·usleep(SB),NOSPLIT,$16
Shenghou Mac30ba7e2012-01-17 03:22:34 +1100264 MOVL $0, DX
265 MOVL usec+0(FP), AX
266 MOVL $1000000, CX
267 DIVL CX
268 MOVQ AX, 0(SP) // tv_sec
269 MOVL $1000, AX
270 MULL DX
271 MOVQ AX, 8(SP) // tv_nsec
272
273 MOVQ SP, DI // arg 1 - rqtp
274 MOVQ $0, SI // arg 2 - rmtp
275 MOVL $240, AX // sys_nanosleep
276 SYSCALL
David Symonds723f73c2011-09-30 16:39:10 -0700277 RET
278
Russ Coxe473f422010-08-04 17:50:22 -0700279// set tls base to DI
Keith Randall0273dc12013-08-07 12:20:05 -0700280TEXT runtime·settls(SB),NOSPLIT,$8
Russ Coxe473f422010-08-04 17:50:22 -0700281 ADDQ $16, DI // adjust for ELF: wants to use -16(FS) and -8(FS) for g and m
282 MOVQ DI, 0(SP)
283 MOVQ SP, SI
284 MOVQ $129, DI // AMD64_SET_FSBASE
285 MOVQ $165, AX // sysarch
286 SYSCALL
287 JCC 2(PC)
Russ Cox36aa7d42012-03-08 14:03:56 -0500288 MOVL $0xf1, 0xf1 // crash
Russ Coxe473f422010-08-04 17:50:22 -0700289 RET
Devon H. O'Dell12bf0002012-01-10 17:39:17 +1100290
Keith Randall0273dc12013-08-07 12:20:05 -0700291TEXT runtime·sysctl(SB),NOSPLIT,$0
Russ Cox25f6b022014-08-27 11:32:17 -0400292 MOVQ mib+0(FP), DI // arg 1 - name
293 MOVL miblen+8(FP), SI // arg 2 - namelen
294 MOVQ out+16(FP), DX // arg 3 - oldp
295 MOVQ size+24(FP), R10 // arg 4 - oldlenp
296 MOVQ dst+32(FP), R8 // arg 5 - newp
297 MOVQ ndst+40(FP), R9 // arg 6 - newlen
Devon H. O'Dell12bf0002012-01-10 17:39:17 +1100298 MOVQ $202, AX // sys___sysctl
299 SYSCALL
Russ Cox25f6b022014-08-27 11:32:17 -0400300 JCC 4(PC)
Russ Coxe3c7a9d2013-03-14 23:42:11 -0400301 NEGQ AX
Russ Cox25f6b022014-08-27 11:32:17 -0400302 MOVL AX, ret+48(FP)
Devon H. O'Dell12bf0002012-01-10 17:39:17 +1100303 RET
304 MOVL $0, AX
Russ Cox25f6b022014-08-27 11:32:17 -0400305 MOVL AX, ret+48(FP)
Devon H. O'Dell12bf0002012-01-10 17:39:17 +1100306 RET
307
Keith Randall0273dc12013-08-07 12:20:05 -0700308TEXT runtime·osyield(SB),NOSPLIT,$-4
Devon H. O'Delldff55352012-02-21 07:32:20 +0900309 MOVL $331, AX // sys_sched_yield
Devon H. O'Dell8542dc02012-02-22 11:04:25 +0900310 SYSCALL
Devon H. O'Delldff55352012-02-21 07:32:20 +0900311 RET
Devon H. O'Dellb0891062012-02-22 15:44:09 +1100312
Keith Randall0273dc12013-08-07 12:20:05 -0700313TEXT runtime·sigprocmask(SB),NOSPLIT,$0
Devon H. O'Dellb0891062012-02-22 15:44:09 +1100314 MOVL $3, DI // arg 1 - how (SIG_SETMASK)
Russ Cox25f6b022014-08-27 11:32:17 -0400315 MOVQ new+0(FP), SI // arg 2 - set
316 MOVQ old+8(FP), DX // arg 3 - oset
Devon H. O'Dellb0891062012-02-22 15:44:09 +1100317 MOVL $340, AX // sys_sigprocmask
318 SYSCALL
319 JAE 2(PC)
Russ Cox36aa7d42012-03-08 14:03:56 -0500320 MOVL $0xf1, 0xf1 // crash
Devon H. O'Dellb0891062012-02-22 15:44:09 +1100321 RET
Mikio Harac5732c82013-05-20 19:25:32 +0900322
323// int32 runtime·kqueue(void);
Keith Randall0273dc12013-08-07 12:20:05 -0700324TEXT runtime·kqueue(SB),NOSPLIT,$0
Mikio Harac5732c82013-05-20 19:25:32 +0900325 MOVQ $0, DI
326 MOVQ $0, SI
327 MOVQ $0, DX
328 MOVL $362, AX
329 SYSCALL
330 JCC 2(PC)
331 NEGQ AX
Russ Cox25f6b022014-08-27 11:32:17 -0400332 MOVL AX, ret+0(FP)
Mikio Harac5732c82013-05-20 19:25:32 +0900333 RET
334
335// int32 runtime·kevent(int kq, Kevent *changelist, int nchanges, Kevent *eventlist, int nevents, Timespec *timeout);
Keith Randall0273dc12013-08-07 12:20:05 -0700336TEXT runtime·kevent(SB),NOSPLIT,$0
Russ Cox25f6b022014-08-27 11:32:17 -0400337 MOVL fd+0(FP), DI
338 MOVQ ev1+8(FP), SI
339 MOVL nev1+16(FP), DX
340 MOVQ ev2+24(FP), R10
341 MOVL nev2+32(FP), R8
342 MOVQ ts+40(FP), R9
Mikio Harac5732c82013-05-20 19:25:32 +0900343 MOVL $363, AX
344 SYSCALL
345 JCC 2(PC)
346 NEGQ AX
Russ Cox25f6b022014-08-27 11:32:17 -0400347 MOVL AX, ret+48(FP)
Mikio Harac5732c82013-05-20 19:25:32 +0900348 RET
349
350// void runtime·closeonexec(int32 fd);
Keith Randall0273dc12013-08-07 12:20:05 -0700351TEXT runtime·closeonexec(SB),NOSPLIT,$0
Russ Cox25f6b022014-08-27 11:32:17 -0400352 MOVL fd+0(FP), DI // fd
Mikio Harac5732c82013-05-20 19:25:32 +0900353 MOVQ $2, SI // F_SETFD
354 MOVQ $1, DX // FD_CLOEXEC
355 MOVL $92, AX // fcntl
356 SYSCALL
357 RET