William Kurkian | ea86948 | 2019-04-09 15:16:11 -0400 | [diff] [blame] | 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. |
| 4 | |
| 5 | // +build !gccgo |
| 6 | |
| 7 | #include "textflag.h" |
| 8 | |
| 9 | // |
| 10 | // System calls for 386, Linux |
| 11 | // |
| 12 | |
| 13 | // See ../runtime/sys_linux_386.s for the reason why we always use int 0x80 |
| 14 | // instead of the glibc-specific "CALL 0x10(GS)". |
| 15 | #define INVOKE_SYSCALL INT $0x80 |
| 16 | |
| 17 | // Just jump to package syscall's implementation for all these functions. |
| 18 | // The runtime may know about them. |
| 19 | |
| 20 | TEXT ·Syscall(SB),NOSPLIT,$0-28 |
| 21 | JMP syscall·Syscall(SB) |
| 22 | |
| 23 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 |
| 24 | JMP syscall·Syscall6(SB) |
| 25 | |
| 26 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-24 |
| 27 | CALL runtime·entersyscall(SB) |
| 28 | MOVL trap+0(FP), AX // syscall entry |
| 29 | MOVL a1+4(FP), BX |
| 30 | MOVL a2+8(FP), CX |
| 31 | MOVL a3+12(FP), DX |
| 32 | MOVL $0, SI |
| 33 | MOVL $0, DI |
| 34 | INVOKE_SYSCALL |
| 35 | MOVL AX, r1+16(FP) |
| 36 | MOVL DX, r2+20(FP) |
| 37 | CALL runtime·exitsyscall(SB) |
| 38 | RET |
| 39 | |
| 40 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 |
| 41 | JMP syscall·RawSyscall(SB) |
| 42 | |
| 43 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 |
| 44 | JMP syscall·RawSyscall6(SB) |
| 45 | |
| 46 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24 |
| 47 | MOVL trap+0(FP), AX // syscall entry |
| 48 | MOVL a1+4(FP), BX |
| 49 | MOVL a2+8(FP), CX |
| 50 | MOVL a3+12(FP), DX |
| 51 | MOVL $0, SI |
| 52 | MOVL $0, DI |
| 53 | INVOKE_SYSCALL |
| 54 | MOVL AX, r1+16(FP) |
| 55 | MOVL DX, r2+20(FP) |
| 56 | RET |
| 57 | |
| 58 | TEXT ·socketcall(SB),NOSPLIT,$0-36 |
| 59 | JMP syscall·socketcall(SB) |
| 60 | |
| 61 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-36 |
| 62 | JMP syscall·rawsocketcall(SB) |
| 63 | |
| 64 | TEXT ·seek(SB),NOSPLIT,$0-28 |
| 65 | JMP syscall·seek(SB) |