| 1 |
// Copyright 2022 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 |
#include "textflag.h" |
| 6 |
|
| 7 |
// See ../sys_linux_386.s for the reason why we always use int 0x80 |
| 8 |
// instead of the glibc-specific "CALL 0x10(GS)". |
| 9 |
#define INVOKE_SYSCALL INT $0x80 |
| 10 |
|
| 11 |
// func Syscall6(num, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, errno uintptr) |
| 12 |
// |
| 13 |
// Syscall # in AX, args in BX CX DX SI DI BP, return in AX |
| 14 |
TEXT ·Syscall6(SB),NOSPLIT,$0-40 |
| 15 |
MOVL num+0(FP), AX // syscall entry |
| 16 |
MOVL a1+4(FP), BX |
| 17 |
MOVL a2+8(FP), CX |
| 18 |
MOVL a3+12(FP), DX |
| 19 |
MOVL a4+16(FP), SI |
| 20 |
MOVL a5+20(FP), DI |
| 21 |
MOVL a6+24(FP), BP |
| 22 |
INVOKE_SYSCALL |
| 23 |
CMPL AX, $0xfffff001 |
| 24 |
JLS ok |
| 25 |
MOVL $-1, r1+28(FP) |
| 26 |
MOVL $0, r2+32(FP) |
| 27 |
NEGL AX |
| 28 |
MOVL AX, errno+36(FP) |
| 29 |
RET |
| 30 |
ok: |
| 31 |
MOVL AX, r1+28(FP) |
| 32 |
MOVL DX, r2+32(FP) |
| 33 |
MOVL $0, errno+36(FP) |
| 34 |
RET |