| 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 |
// func Syscall6(num, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, errno uintptr) |
| 8 |
// |
| 9 |
// We need to convert to the syscall ABI. |
| 10 |
// |
| 11 |
// arg | ABIInternal | Syscall |
| 12 |
// --------------------------- |
| 13 |
// num | R4 | R11 |
| 14 |
// a1 | R5 | R4 |
| 15 |
// a2 | R6 | R5 |
| 16 |
// a3 | R7 | R6 |
| 17 |
// a4 | R8 | R7 |
| 18 |
// a5 | R9 | R8 |
| 19 |
// a6 | R10 | R9 |
| 20 |
// |
| 21 |
// r1 | R4 | R4 |
| 22 |
// r2 | R5 | R5 |
| 23 |
// err | R6 | part of R4 |
| 24 |
TEXT ·Syscall6<ABIInternal>(SB),NOSPLIT,$0-80 |
| 25 |
MOVV R4, R11 // syscall entry |
| 26 |
MOVV R5, R4 |
| 27 |
MOVV R6, R5 |
| 28 |
MOVV R7, R6 |
| 29 |
MOVV R8, R7 |
| 30 |
MOVV R9, R8 |
| 31 |
MOVV R10, R9 |
| 32 |
SYSCALL |
| 33 |
MOVV R0, R5 // r2 is not used. Always set to 0. |
| 34 |
MOVW $-4096, R12 |
| 35 |
BGEU R12, R4, ok |
| 36 |
SUBVU R4, R0, R6 // errno |
| 37 |
MOVV $-1, R4 // r1 |
| 38 |
RET |
| 39 |
ok: |
| 40 |
// r1 already in R4 |
| 41 |
MOVV R0, R6 // errno |
| 42 |
RET |