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

View as plain text