github.com/ice-blockchain/go/src@v0.0.0-20240403114104-1564d284e521/internal/runtime/syscall/asm_linux_loong64.s (about) 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 // func Syscall6(num, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, errno uintptr) 8 // 9 // We need to convert to the syscall ABI. 10 // 11 // arg | ABIInternal | Syscall 12 // --------------------------- 13 // num | R4 | R11 14 // a1 | R5 | R4 15 // a2 | R6 | R5 16 // a3 | R7 | R6 17 // a4 | R8 | R7 18 // a5 | R9 | R8 19 // a6 | R10 | R9 20 // 21 // r1 | R4 | R4 22 // r2 | R5 | R5 23 // err | R6 | part of R4 24 TEXT ·Syscall6<ABIInternal>(SB),NOSPLIT,$0-80 25 #ifdef GOEXPERIMENT_regabiargs 26 MOVV R4, R11 // syscall entry 27 MOVV R5, R4 28 MOVV R6, R5 29 MOVV R7, R6 30 MOVV R8, R7 31 MOVV R9, R8 32 MOVV R10, R9 33 #else 34 MOVV num+0(FP), R11 // syscall entry 35 MOVV a1+8(FP), R4 36 MOVV a2+16(FP), R5 37 MOVV a3+24(FP), R6 38 MOVV a4+32(FP), R7 39 MOVV a5+40(FP), R8 40 MOVV a6+48(FP), R9 41 #endif 42 SYSCALL 43 #ifdef GOEXPERIMENT_regabiargs 44 MOVV R0, R5 // r2 is not used. Always set to 0. 45 MOVW $-4096, R12 46 BGEU R12, R4, ok 47 SUBVU R4, R0, R6 // errno 48 MOVV $-1, R4 // r1 49 #else 50 MOVW $-4096, R12 51 BGEU R12, R4, ok 52 MOVV $-1, R12 53 MOVV R12, r1+56(FP) 54 MOVV R0, r2+64(FP) 55 SUBVU R4, R0, R4 56 MOVV R4, errno+72(FP) 57 #endif 58 RET 59 ok: 60 #ifdef GOEXPERIMENT_regabiargs 61 // r1 already in R4 62 MOVV R0, R6 // errno 63 #else 64 MOVV R4, r1+56(FP) 65 MOVV R0, r2+64(FP) // r2 is not used. Always set to 0. 66 MOVV R0, errno+72(FP) 67 #endif 68 RET