]> Cypherpunks.ru repositories - gostls13.git/blob - src/syscall/asm_linux_riscv64.s
6fd09ec4222a93ddf4355b10ab03b70e499f6b98
[gostls13.git] / src / syscall / asm_linux_riscv64.s
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 rawVforkSyscall(trap, a1, a2 uintptr) (r1, err uintptr)
12 TEXT ·rawVforkSyscall(SB),NOSPLIT|NOFRAME,$0-40
13         MOV     a1+8(FP), A0
14         MOV     a2+16(FP), A1
15         MOV     ZERO, A2
16         MOV     ZERO, A3
17         MOV     ZERO, A4
18         MOV     ZERO, A5
19         MOV     trap+0(FP), A7  // syscall entry
20         ECALL
21         MOV     $-4096, T0
22         BLTU    T0, A0, err
23         MOV     A0, r1+24(FP)   // r1
24         MOV     ZERO, err+32(FP)        // errno
25         RET
26 err:
27         MOV     $-1, T0
28         MOV     T0, r1+24(FP)   // r1
29         SUB     A0, ZERO, A0
30         MOV     A0, err+32(FP)  // errno
31         RET
32
33 TEXT ·rawSyscallNoError(SB),NOSPLIT,$0-48
34         MOV     a1+8(FP), A0
35         MOV     a2+16(FP), A1
36         MOV     a3+24(FP), A2
37         MOV     trap+0(FP), A7  // syscall entry
38         ECALL
39         MOV     A0, r1+32(FP)
40         MOV     A1, r2+40(FP)
41         RET