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.
5
#include "../../cmd/ld/textflag.h"
8
// System call support for AMD64, Darwin
11
// func Syscall(trap int64, a1, a2, a3 int64) (r1, r2, err int64);
12
// func Syscall6(trap int64, a1, a2, a3, a4, a5, a6 int64) (r1, r2, err int64);
13
// Trap # in AX, args in DI SI DX, return in AX DX
15
TEXT ·Syscall(SB),NOSPLIT,$0-64
16
CALL runtime·entersyscall(SB)
23
MOVQ 8(SP), AX // syscall entry
27
MOVQ $-1, 40(SP) // r1
29
MOVQ AX, 56(SP) // errno
30
CALL runtime·exitsyscall(SB)
35
MOVQ $0, 56(SP) // errno
36
CALL runtime·exitsyscall(SB)
39
TEXT ·Syscall6(SB),NOSPLIT,$0-88
40
CALL runtime·entersyscall(SB)
47
MOVQ 8(SP), AX // syscall entry
51
MOVQ $-1, 64(SP) // r1
53
MOVQ AX, 80(SP) // errno
54
CALL runtime·exitsyscall(SB)
59
MOVQ $0, 80(SP) // errno
60
CALL runtime·exitsyscall(SB)
63
TEXT ·RawSyscall(SB),NOSPLIT,$0-64
70
MOVQ 8(SP), AX // syscall entry
74
MOVQ $-1, 40(SP) // r1
76
MOVQ AX, 56(SP) // errno
81
MOVQ $0, 56(SP) // errno
84
TEXT ·RawSyscall6(SB),NOSPLIT,$0-88
91
MOVQ 8(SP), AX // syscall entry
95
MOVQ $-1, 64(SP) // r1
97
MOVQ AX, 80(SP) // errno
100
MOVQ AX, 64(SP) // r1
101
MOVQ DX, 72(SP) // r2
102
MOVQ $0, 80(SP) // errno