1 // 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.
9 // System calls for 386, Linux
12 // See ../runtime/sys_linux_386.s for the reason why we always use int 0x80
13 // instead of the glibc-specific "CALL 0x10(GS)".
14 #define INVOKE_SYSCALL INT $0x80
16 // func rawVforkSyscall(trap, a1, a2 uintptr) (r1, err uintptr)
17 TEXT ·rawVforkSyscall(SB),NOSPLIT|NOFRAME,$0-20
18 MOVL trap+0(FP), AX // syscall entry
22 POPL SI // preserve return address
36 // func rawSyscallNoError(trap uintptr, a1, a2, a3 uintptr) (r1, r2 uintptr);
37 TEXT ·rawSyscallNoError(SB),NOSPLIT,$0-24
38 MOVL trap+0(FP), AX // syscall entry
49 #define SYS_SOCKETCALL 102 /* from zsysnum_linux_386.go */
51 // func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err int)
52 // Kernel interface gets call sub-number and pointer to a0.
53 TEXT ·socketcall(SB),NOSPLIT,$0-36
54 CALL runtime·entersyscall(SB)
55 MOVL $SYS_SOCKETCALL, AX // syscall entry
56 MOVL call+0(FP), BX // socket call number
57 LEAL a0+4(FP), CX // pointer to call arguments
67 CALL runtime·exitsyscall(SB)
72 CALL runtime·exitsyscall(SB)
75 // func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err int)
76 // Kernel interface gets call sub-number and pointer to a0.
77 TEXT ·rawsocketcall(SB),NOSPLIT,$0-36
78 MOVL $SYS_SOCKETCALL, AX // syscall entry
79 MOVL call+0(FP), BX // socket call number
80 LEAL a0+4(FP), CX // pointer to call arguments
96 #define SYS__LLSEEK 140 /* from zsysnum_linux_386.go */
97 // func Seek(fd int, offset int64, whence int) (newoffset int64, err int)
98 // Implemented in assembly to avoid allocation when
99 // taking the address of the return value newoffset.
100 // Underlying system call is
101 // llseek(int fd, int offhi, int offlo, int64 *result, int whence)
102 TEXT ·seek(SB),NOSPLIT,$0-28
103 CALL runtime·entersyscall(SB)
104 MOVL $SYS__LLSEEK, AX // syscall entry
106 MOVL offset_hi+8(FP), CX
107 MOVL offset_lo+4(FP), DX
108 LEAL newoffset_lo+16(FP), SI // result pointer
109 MOVL whence+12(FP), DI
113 MOVL $-1, newoffset_lo+16(FP)
114 MOVL $-1, newoffset_hi+20(FP)
117 CALL runtime·exitsyscall(SB)
120 // system call filled in newoffset already
122 CALL runtime·exitsyscall(SB)