]> Cypherpunks.ru repositories - gostls13.git/blob - src/syscall/asm_linux_loong64.s
1a7457c7ead893f7ec29e9ea9a91040e22a10163
[gostls13.git] / src / syscall / asm_linux_loong64.s
1 // Copyright 2022 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 loong64, Linux
9 //
10
11 // func rawVforkSyscall(trap, a1, a2 uintptr) (r1, err uintptr)
12 TEXT ·rawVforkSyscall(SB),NOSPLIT,$0-40
13         MOVV    a1+8(FP), R4
14         MOVV    a2+16(FP), R5
15         MOVV    $0, R6
16         MOVV    $0, R7
17         MOVV    $0, R8
18         MOVV    $0, R9
19         MOVV    trap+0(FP), R11 // syscall entry
20         SYSCALL
21         MOVW    $-4096, R12
22         BGEU    R12, R4, ok
23         MOVV    $-1, R12
24         MOVV    R12, r1+24(FP)          // r1
25         SUBVU   R4, R0, R4
26         MOVV    R4, err+32(FP)          // errno
27         RET
28 ok:
29         MOVV    R4, r1+24(FP)   // r1
30         MOVV    R0, err+32(FP)  // errno
31         RET
32
33 TEXT ·rawSyscallNoError(SB),NOSPLIT,$0-48
34         MOVV    a1+8(FP), R4
35         MOVV    a2+16(FP), R5
36         MOVV    a3+24(FP), R6
37         MOVV    R0, R7
38         MOVV    R0, R8
39         MOVV    R0, R9
40         MOVV    trap+0(FP), R11 // syscall entry
41         SYSCALL
42         MOVV    R4, r1+32(FP)
43         MOVV    R0, r2+40(FP)   // r2 is not used. Always set to 0.
44         RET