...
Run Format

Text file src/syscall/asm_linux_mipsx.s

Documentation: syscall

     1	// Copyright 2016 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	// +build linux
     6	// +build mips mipsle
     7	
     8	#include "textflag.h"
     9	#include "funcdata.h"
    10	
    11	//
    12	// System calls for mips, Linux
    13	//
    14	
    15	// func Syscall(trap uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr);
    16	TEXT ·Syscall(SB),NOSPLIT,$0-28
    17		JAL	runtime·entersyscall(SB)
    18		MOVW	a1+4(FP), R4
    19		MOVW	a2+8(FP), R5
    20		MOVW	a3+12(FP), R6
    21		MOVW	R0, R7
    22		MOVW	trap+0(FP), R2	// syscall entry
    23		SYSCALL
    24		BEQ	R7, ok
    25		MOVW	$-1, R1
    26		MOVW	R1, r1+16(FP)	// r1
    27		MOVW	R0, r2+20(FP)	// r2
    28		MOVW	R2, err+24(FP)	// errno
    29		JAL	runtime·exitsyscall(SB)
    30		RET
    31	ok:
    32		MOVW	R2, r1+16(FP)	// r1
    33		MOVW	R3, r2+20(FP)	// r2
    34		MOVW	R0, err+24(FP)	// errno
    35		JAL	runtime·exitsyscall(SB)
    36		RET
    37	
    38	// func Syscall6(trap trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr);
    39	// 5th and 6th arg go at sp+16, sp+20.
    40	// Note that frame size of 20 means that 24 bytes gets reserved on stack.
    41	TEXT ·Syscall6(SB),NOSPLIT,$20-40
    42		NO_LOCAL_POINTERS
    43		JAL	runtime·entersyscall(SB)
    44		MOVW	a1+4(FP), R4
    45		MOVW	a2+8(FP), R5
    46		MOVW	a3+12(FP), R6
    47		MOVW	a4+16(FP), R7
    48		MOVW	a5+20(FP), R8
    49		MOVW	a6+24(FP), R9
    50		MOVW	R8, 16(R29)
    51		MOVW	R9, 20(R29)
    52		MOVW	trap+0(FP), R2	// syscall entry
    53		SYSCALL
    54		BEQ	R7, ok6
    55		MOVW	$-1, R1
    56		MOVW	R1, r1+28(FP)	// r1
    57		MOVW	R0, r2+32(FP)	// r2
    58		MOVW	R2, err+36(FP)	// errno
    59		JAL	runtime·exitsyscall(SB)
    60		RET
    61	ok6:
    62		MOVW	R2, r1+28(FP)	// r1
    63		MOVW	R3, r2+32(FP)	// r2
    64		MOVW	R0, err+36(FP)	// errno
    65		JAL	runtime·exitsyscall(SB)
    66		RET
    67	
    68	// func Syscall9(trap trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2, err uintptr);
    69	// Actually Syscall8 but the rest of the code expects it to be named Syscall9.
    70	TEXT ·Syscall9(SB),NOSPLIT,$28-52
    71		NO_LOCAL_POINTERS
    72		JAL	runtime·entersyscall(SB)
    73		MOVW	a1+4(FP), R4
    74		MOVW	a2+8(FP), R5
    75		MOVW	a3+12(FP), R6
    76		MOVW	a4+16(FP), R7
    77		MOVW	a5+20(FP), R8
    78		MOVW	a6+24(FP), R9
    79		MOVW	a7+28(FP), R10
    80		MOVW	a8+32(FP), R11
    81		MOVW	R8, 16(R29)
    82		MOVW	R9, 20(R29)
    83		MOVW	R10, 24(R29)
    84		MOVW	R11, 28(R29)
    85		MOVW	trap+0(FP), R2	// syscall entry
    86		SYSCALL
    87		BEQ	R7, ok9
    88		MOVW	$-1, R1
    89		MOVW	R1, r1+40(FP)	// r1
    90		MOVW	R0, r2+44(FP)	// r2
    91		MOVW	R2, err+48(FP)	// errno
    92		JAL	runtime·exitsyscall(SB)
    93		RET
    94	ok9:
    95		MOVW	R2, r1+40(FP)	// r1
    96		MOVW	R3, r2+44(FP)	// r2
    97		MOVW	R0, err+48(FP)	// errno
    98		JAL	runtime·exitsyscall(SB)
    99		RET
   100	
   101	TEXT ·RawSyscall(SB),NOSPLIT,$24-28
   102		MOVW	a1+4(FP), R4
   103		MOVW	a2+8(FP), R5
   104		MOVW	a3+12(FP), R6
   105		MOVW	trap+0(FP), R2	// syscall entry
   106		SYSCALL
   107		BEQ	R7, ok1
   108		MOVW	$-1, R1
   109		MOVW	R1, r1+16(FP)	// r1
   110		MOVW	R0, r2+20(FP)	// r2
   111		MOVW	R2, err+24(FP)	// errno
   112		RET
   113	ok1:
   114		MOVW	R2, r1+16(FP)	// r1
   115		MOVW	R3, r2+20(FP)	// r2
   116		MOVW	R0, err+24(FP)	// errno
   117		RET
   118	
   119	TEXT ·RawSyscall6(SB),NOSPLIT,$20-40
   120		MOVW	a1+4(FP), R4
   121		MOVW	a2+8(FP), R5
   122		MOVW	a3+12(FP), R6
   123		MOVW	a4+16(FP), R7
   124		MOVW	a5+20(FP), R8
   125		MOVW	a6+24(FP), R9
   126		MOVW	R8, 16(R29)
   127		MOVW	R9, 20(R29)
   128		MOVW	trap+0(FP), R2	// syscall entry
   129		SYSCALL
   130		BEQ	R7, ok2
   131		MOVW	$-1, R1
   132		MOVW	R1, r1+28(FP)	// r1
   133		MOVW	R0, r2+32(FP)	// r2
   134		MOVW	R2, err+36(FP)	// errno
   135		RET
   136	ok2:
   137		MOVW	R2, r1+28(FP)	// r1
   138		MOVW	R3, r2+32(FP)	// r2
   139		MOVW	R0, err+36(FP)	// errno
   140		RET
   141	
   142	TEXT ·rawSyscallNoError(SB),NOSPLIT,$20-24
   143		MOVW	a1+4(FP), R4
   144		MOVW	a2+8(FP), R5
   145		MOVW	a3+12(FP), R6
   146		MOVW	trap+0(FP), R2	// syscall entry
   147		SYSCALL
   148		MOVW	R2, r1+16(FP)	// r1
   149		MOVW	R3, r2+20(FP)	// r2
   150		RET

View as plain text