github.com/usbarmory/GoTEE@v0.0.0-20240405084336-c52770d9fcdb/syscall/syscall_riscv64.s (about)

     1  // Copyright (c) WithSecure Corporation
     2  // https://foundry.withsecure.com
     3  //
     4  // Use of this source code is governed by the license
     5  // that can be found in the LICENSE file.
     6  
     7  #include "go_asm.h"
     8  
     9  // A7 must be set to 0 to avoid interference with SBI
    10  
    11  // func Supervisor()
    12  TEXT ·Supervisor(SB),$0
    13  	MOV	$0, A7
    14  	ECALL
    15  
    16  	RET
    17  
    18  // func Exit()
    19  TEXT ·Exit(SB),$0
    20  	MOV	$const_SYS_EXIT, A0
    21  
    22  	MOV	$0, A7
    23  	ECALL
    24  
    25  	RET
    26  
    27  // func Print(c byte)
    28  TEXT ·Print(SB),$0-1
    29  	MOV	$const_SYS_WRITE, A0
    30  	MOV	c+0(FP), A1
    31  
    32  	MOV	$0, A7
    33  	ECALL
    34  
    35  	RET
    36  
    37  // func Nanotime() int64
    38  TEXT ·Nanotime(SB),$0-8
    39  	MOV	$const_SYS_NANOTIME, A0
    40  
    41  	MOV	$0, A7
    42  	ECALL
    43  
    44  	MOV	A0, ret+0(FP)
    45  
    46  	RET
    47  
    48  // func Write(trap uint, b []byte, n uint)
    49  TEXT ·Write(SB),$0-40
    50  	MOV	trap+0(FP), A0
    51  	MOV	b+8(FP), A1
    52  	MOV	n+32(FP), A2
    53  
    54  	MOV	$0, A7
    55  	ECALL
    56  
    57  	RET
    58  
    59  // func Read(trap uint, b []byte, n uint) int
    60  TEXT ·Read(SB),$0-48
    61  	MOV	trap+0(FP), A0
    62  	MOV	b+8(FP), A1
    63  	MOV	n+32(FP), A2
    64  
    65  	MOV	$0, A7
    66  	ECALL
    67  
    68  	MOV	A0, ret+40(FP)
    69  
    70  	RET