1// +build netbsd openbsd
2
3// Copyright 2016 The Go Authors. All rights reserved.
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
7#include "textflag.h"
8#include "funcdata.h"
9
10//
11// Syscall9 support for AMD64, NetBSD and OpenBSD
12//
13
14// func Syscall9(trap int64, a1, a2, a3, a4, a5, a6, a7, a8, a9 int64) (r1, r2, err int64);
15TEXT	·Syscall9(SB),NOSPLIT,$0-104
16	CALL	runtime·entersyscall(SB)
17	MOVQ	num+0(FP), AX	// syscall entry
18	MOVQ	a1+8(FP), DI
19	MOVQ	a2+16(FP), SI
20	MOVQ	a3+24(FP), DX
21	MOVQ	a4+32(FP), R10
22	MOVQ	a5+40(FP), R8
23	MOVQ	a6+48(FP), R9
24	MOVQ	a7+56(FP), R11
25	MOVQ	a8+64(FP), R12
26	MOVQ	a9+72(FP), R13
27	SUBQ    $32, SP
28	MOVQ	R11, 8(SP)	// arg 7
29	MOVQ	R12, 16(SP)	// arg 8
30	MOVQ	R13, 24(SP)	// arg 9
31	SYSCALL
32	JCC	ok9
33	ADDQ    $32, SP
34	MOVQ	$-1, 88(SP)	// r1
35	MOVQ	$0, 96(SP)	// r2
36	MOVQ	AX, 104(SP)	// errno
37	CALL	runtime·exitsyscall(SB)
38	RET
39ok9:
40	ADDQ    $32, SP
41	MOVQ	AX, 88(SP)	// r1
42	MOVQ	DX, 96(SP)	// r2
43	MOVQ	$0, 104(SP)	// errno
44	CALL	runtime·exitsyscall(SB)
45	RET
46