Black Lives Matter. Support the Equal Justice Initiative.

Text file src/syscall/asm_linux_riscv64.s

Documentation: syscall

     1// Copyright 2019 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//
     8// System calls for riscv64, Linux
     9//
    10
    11// func Syscall(trap int64, a1, a2, a3 int64) (r1, r2, err int64)
    12TEXT ·Syscall(SB),NOSPLIT,$0-56
    13	CALL	runtime·entersyscall(SB)
    14	MOV	a1+8(FP), A0
    15	MOV	a2+16(FP), A1
    16	MOV	a3+24(FP), A2
    17	MOV	trap+0(FP), A7	// syscall entry
    18	ECALL
    19	MOV	$-4096, T0
    20	BLTU	T0, A0, err
    21	MOV	A0, r1+32(FP)	// r1
    22	MOV	A1, r2+40(FP)	// r2
    23	MOV	ZERO, err+48(FP)	// errno
    24	CALL	runtime·exitsyscall(SB)
    25	RET
    26err:
    27	MOV	$-1, T0
    28	MOV	T0, r1+32(FP)	// r1
    29	MOV	ZERO, r2+40(FP)	// r2
    30	SUB	A0, ZERO, A0
    31	MOV	A0, err+48(FP)	// errno
    32	CALL	runtime·exitsyscall(SB)
    33	RET
    34
    35// func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
    36TEXT ·Syscall6(SB),NOSPLIT,$0-80
    37	CALL	runtime·entersyscall(SB)
    38	MOV	a1+8(FP), A0
    39	MOV	a2+16(FP), A1
    40	MOV	a3+24(FP), A2
    41	MOV	a4+32(FP), A3
    42	MOV	a5+40(FP), A4
    43	MOV	a6+48(FP), A5
    44	MOV	trap+0(FP), A7	// syscall entry
    45	ECALL
    46	MOV	$-4096, T0
    47	BLTU	T0, A0, err
    48	MOV	A0, r1+56(FP)	// r1
    49	MOV	A1, r2+64(FP)	// r2
    50	MOV	ZERO, err+72(FP)	// errno
    51	CALL	runtime·exitsyscall(SB)
    52	RET
    53err:
    54	MOV	$-1, T0
    55	MOV	T0, r1+56(FP)	// r1
    56	MOV	ZERO, r2+64(FP)	// r2
    57	SUB	A0, ZERO, A0
    58	MOV	A0, err+72(FP)	// errno
    59	CALL	runtime·exitsyscall(SB)
    60	RET
    61
    62// func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
    63TEXT ·RawSyscall(SB),NOSPLIT,$0-56
    64	MOV	a1+8(FP), A0
    65	MOV	a2+16(FP), A1
    66	MOV	a3+24(FP), A2
    67	MOV	trap+0(FP), A7	// syscall entry
    68	ECALL
    69	MOV	$-4096, T0
    70	BLTU	T0, A0, err
    71	MOV	A0, r1+32(FP)	// r1
    72	MOV	A1, r2+40(FP)	// r2
    73	MOV	ZERO, err+48(FP)	// errno
    74	RET
    75err:
    76	MOV	$-1, T0
    77	MOV	T0, r1+32(FP)	// r1
    78	MOV	ZERO, r2+40(FP)	// r2
    79	SUB	A0, ZERO, A0
    80	MOV	A0, err+48(FP)	// errno
    81	RET
    82
    83// func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
    84TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
    85	MOV	a1+8(FP), A0
    86	MOV	a2+16(FP), A1
    87	MOV	a3+24(FP), A2
    88	MOV	a4+32(FP), A3
    89	MOV	a5+40(FP), A4
    90	MOV	a6+48(FP), A5
    91	MOV	trap+0(FP), A7	// syscall entry
    92	ECALL
    93	MOV	$-4096, T0
    94	BLTU	T0, A0, err
    95	MOV	A0, r1+56(FP)	// r1
    96	MOV	A1, r2+64(FP)	// r2
    97	MOV	ZERO, err+72(FP)	// errno
    98	RET
    99err:
   100	MOV	$-1, T0
   101	MOV	T0, r1+56(FP)	// r1
   102	MOV	ZERO, r2+64(FP)	// r2
   103	SUB	A0, ZERO, A0
   104	MOV	A0, err+72(FP)	// errno
   105	RET
   106
   107TEXT ·rawSyscallNoError(SB),NOSPLIT,$0-48
   108	MOV	a1+8(FP), A0
   109	MOV	a2+16(FP), A1
   110	MOV	a3+24(FP), A2
   111	MOV	trap+0(FP), A7	// syscall entry
   112	ECALL
   113	MOV	A0, r1+32(FP)
   114	MOV	A1, r2+40(FP)
   115	RET

View as plain text