github.com/s1s1ty/go@v0.0.0-20180207192209-104445e3140f/src/syscall/asm_linux_arm64.s (about) 1 // Copyright 2015 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 Syscall(trap int64, a1, a2, a3 int64) (r1, r2, err int64); 8 9 TEXT ·Syscall(SB),NOSPLIT,$0-56 10 BL runtime·entersyscall(SB) 11 MOVD a1+8(FP), R0 12 MOVD a2+16(FP), R1 13 MOVD a3+24(FP), R2 14 MOVD $0, R3 15 MOVD $0, R4 16 MOVD $0, R5 17 MOVD trap+0(FP), R8 // syscall entry 18 SVC 19 CMN $4095, R0 20 BCC ok 21 MOVD $-1, R4 22 MOVD R4, r1+32(FP) // r1 23 MOVD ZR, r2+40(FP) // r2 24 NEG R0, R0 25 MOVD R0, err+48(FP) // errno 26 BL runtime·exitsyscall(SB) 27 RET 28 ok: 29 MOVD R0, r1+32(FP) // r1 30 MOVD R1, r2+40(FP) // r2 31 MOVD ZR, err+48(FP) // errno 32 BL runtime·exitsyscall(SB) 33 RET 34 35 TEXT ·Syscall6(SB),NOSPLIT,$0-80 36 BL runtime·entersyscall(SB) 37 MOVD a1+8(FP), R0 38 MOVD a2+16(FP), R1 39 MOVD a3+24(FP), R2 40 MOVD a4+32(FP), R3 41 MOVD a5+40(FP), R4 42 MOVD a6+48(FP), R5 43 MOVD trap+0(FP), R8 // syscall entry 44 SVC 45 CMN $4095, R0 46 BCC ok 47 MOVD $-1, R4 48 MOVD R4, r1+56(FP) // r1 49 MOVD ZR, r2+64(FP) // r2 50 NEG R0, R0 51 MOVD R0, err+72(FP) // errno 52 BL runtime·exitsyscall(SB) 53 RET 54 ok: 55 MOVD R0, r1+56(FP) // r1 56 MOVD R1, r2+64(FP) // r2 57 MOVD ZR, err+72(FP) // errno 58 BL runtime·exitsyscall(SB) 59 RET 60 61 TEXT ·RawSyscall(SB),NOSPLIT,$0-56 62 MOVD a1+8(FP), R0 63 MOVD a2+16(FP), R1 64 MOVD a3+24(FP), R2 65 MOVD $0, R3 66 MOVD $0, R4 67 MOVD $0, R5 68 MOVD trap+0(FP), R8 // syscall entry 69 SVC 70 CMN $4095, R0 71 BCC ok 72 MOVD $-1, R4 73 MOVD R4, r1+32(FP) // r1 74 MOVD ZR, r2+40(FP) // r2 75 NEG R0, R0 76 MOVD R0, err+48(FP) // errno 77 RET 78 ok: 79 MOVD R0, r1+32(FP) // r1 80 MOVD R1, r2+40(FP) // r2 81 MOVD ZR, err+48(FP) // errno 82 RET 83 84 TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 85 MOVD a1+8(FP), R0 86 MOVD a2+16(FP), R1 87 MOVD a3+24(FP), R2 88 MOVD a4+32(FP), R3 89 MOVD a5+40(FP), R4 90 MOVD a6+48(FP), R5 91 MOVD trap+0(FP), R8 // syscall entry 92 SVC 93 CMN $4095, R0 94 BCC ok 95 MOVD $-1, R4 96 MOVD R4, r1+56(FP) // r1 97 MOVD ZR, r2+64(FP) // r2 98 NEG R0, R0 99 MOVD R0, err+72(FP) // errno 100 RET 101 ok: 102 MOVD R0, r1+56(FP) // r1 103 MOVD R1, r2+64(FP) // r2 104 MOVD ZR, err+72(FP) // errno 105 RET