Text file src/syscall/asm_openbsd_mips64.s

     1  // Copyright 2020 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 Syscall(trap int64, a1, a2, a3 int64) (r1, r2, err int64);
     8  TEXT ·Syscall(SB),NOSPLIT,$0-56
     9  	JAL	runtime·entersyscall(SB)
    10  	MOVV	a1+8(FP), R4
    11  	MOVV	a2+16(FP), R5
    12  	MOVV	a3+24(FP), R6
    13  	MOVV	R0, R7
    14  	MOVV	R0, R8
    15  	MOVV	R0, R9
    16  	MOVV	trap+0(FP), R2	// syscall entry
    17  	SYSCALL
    18  	BEQ	R7, ok
    19  	MOVV	$-1, R1
    20  	MOVV	R1, r1+32(FP)	// r1
    21  	MOVV	R0, r2+40(FP)	// r2
    22  	MOVV	R2, err+48(FP)	// errno
    23  	JAL	runtime·exitsyscall(SB)
    24  	RET
    25  ok:
    26  	MOVV	R2, r1+32(FP)	// r1
    27  	MOVV	R3, r2+40(FP)	// r2
    28  	MOVV	R0, err+48(FP)	// errno
    29  	JAL	runtime·exitsyscall(SB)
    30  	RET
    31  
    32  TEXT ·Syscall6(SB),NOSPLIT,$0-80
    33  	JAL	runtime·entersyscall(SB)
    34  	MOVV	a1+8(FP), R4
    35  	MOVV	a2+16(FP), R5
    36  	MOVV	a3+24(FP), R6
    37  	MOVV	a4+32(FP), R7
    38  	MOVV	a5+40(FP), R8
    39  	MOVV	a6+48(FP), R9
    40  	MOVV	trap+0(FP), R2	// syscall entry
    41  	SYSCALL
    42  	BEQ	R7, ok6
    43  	MOVV	$-1, R1
    44  	MOVV	R1, r1+56(FP)	// r1
    45  	MOVV	R0, r2+64(FP)	// r2
    46  	MOVV	R2, err+72(FP)	// errno
    47  	JAL	runtime·exitsyscall(SB)
    48  	RET
    49  ok6:
    50  	MOVV	R2, r1+56(FP)	// r1
    51  	MOVV	R3, r2+64(FP)	// r2
    52  	MOVV	R0, err+72(FP)	// errno
    53  	JAL	runtime·exitsyscall(SB)
    54  	RET
    55  
    56  // func Syscall9(trap int64, a1, a2, a3, a4, a5, a6, a7, a8, a9 int64) (r1, r2, err int64);
    57  // The openbsd/mips64 kernel only accepts eight syscall arguments, except
    58  // for SYS_syscall, where an additional argument can be passed on the stack.
    59  TEXT	·Syscall9(SB),NOSPLIT,$0-104
    60  	JAL	runtime·entersyscall(SB)
    61  	MOVV	num+0(FP), R2	// syscall entry
    62  	MOVV	a1+8(FP), R4
    63  	MOVV	a2+16(FP), R5
    64  	MOVV	a3+24(FP), R6
    65  	MOVV	a4+32(FP), R7
    66  	MOVV	a5+40(FP), R8
    67  	MOVV	a6+48(FP), R9
    68  	MOVV	a7+56(FP), R10
    69  	MOVV	a8+64(FP), R11
    70  	MOVV	a9+72(FP), R12
    71  	SUBVU	$16, R29
    72  	MOVV	R12, 0(R29)	// arg 9 - only used for SYS_syscall.
    73  	SYSCALL
    74  	ADDV    $16, R29
    75  	BEQ	R7, ok9
    76  	MOVV	$-1, R1
    77  	MOVV	R1, r1+80(FP)	// r1
    78  	MOVV	R0, r2+88(FP)	// r2
    79  	MOVV	R2, err+96(FP)	// errno
    80  	JAL	runtime·exitsyscall(SB)
    81  	RET
    82  ok9:
    83  	MOVV	R2, r1+80(FP)	// r1
    84  	MOVV	R3, r2+88(FP)	// r2
    85  	MOVV	R0, err+96(FP)	// errno
    86  	CALL	runtime·exitsyscall(SB)
    87  	RET
    88  
    89  TEXT ·RawSyscall(SB),NOSPLIT,$0-56
    90  	MOVV	a1+8(FP), R4
    91  	MOVV	a2+16(FP), R5
    92  	MOVV	a3+24(FP), R6
    93  	MOVV	R0, R7
    94  	MOVV	R0, R8
    95  	MOVV	R0, R9
    96  	MOVV	trap+0(FP), R2	// syscall entry
    97  	SYSCALL
    98  	BEQ	R7, ok1
    99  	MOVV	$-1, R1
   100  	MOVV	R1, r1+32(FP)	// r1
   101  	MOVV	R0, r2+40(FP)	// r2
   102  	MOVV	R2, err+48(FP)	// errno
   103  	RET
   104  ok1:
   105  	MOVV	R2, r1+32(FP)	// r1
   106  	MOVV	R3, r2+40(FP)	// r2
   107  	MOVV	R0, err+48(FP)	// errno
   108  	RET
   109  
   110  TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
   111  	MOVV	a1+8(FP), R4
   112  	MOVV	a2+16(FP), R5
   113  	MOVV	a3+24(FP), R6
   114  	MOVV	a4+32(FP), R7
   115  	MOVV	a5+40(FP), R8
   116  	MOVV	a6+48(FP), R9
   117  	MOVV	trap+0(FP), R2	// syscall entry
   118  	SYSCALL
   119  	BEQ	R7, ok2
   120  	MOVV	$-1, R1
   121  	MOVV	R1, r1+56(FP)	// r1
   122  	MOVV	R0, r2+64(FP)	// r2
   123  	MOVV	R2, err+72(FP)	// errno
   124  	RET
   125  ok2:
   126  	MOVV	R2, r1+56(FP)	// r1
   127  	MOVV	R3, r2+64(FP)	// r2
   128  	MOVV	R0, err+72(FP)	// errno
   129  	RET
   130  

View as plain text