github.com/m10x/go/src@v0.0.0-20220112094212-ba61592315da/syscall/asm_freebsd_arm.s (about) 1 // Copyright 2012 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 #include "funcdata.h" 7 8 // 9 // System call support for ARM, FreeBSD 10 // 11 12 // func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, errno uintptr); 13 // func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, errno uintptr); 14 // func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2, errno uintptr) 15 16 TEXT ·Syscall(SB),NOSPLIT,$0-28 17 BL runtime·entersyscall(SB) 18 MOVW trap+0(FP), R7 // syscall number 19 MOVW a1+4(FP), R0 // a1 20 MOVW a2+8(FP), R1 // a2 21 MOVW a3+12(FP), R2 // a3 22 SWI $0 // syscall 23 MOVW $0, R2 24 BCS error 25 MOVW R0, r1+16(FP) // r1 26 MOVW R1, r2+20(FP) // r2 27 MOVW R2, err+24(FP) // errno 28 BL runtime·exitsyscall(SB) 29 RET 30 error: 31 MOVW $-1, R3 32 MOVW R3, r1+16(FP) // r1 33 MOVW R2, r2+20(FP) // r2 34 MOVW R0, err+24(FP) // errno 35 BL runtime·exitsyscall(SB) 36 RET 37 38 TEXT ·Syscall6(SB),NOSPLIT,$0-40 39 BL runtime·entersyscall(SB) 40 MOVW trap+0(FP), R7 // syscall number 41 MOVW a1+4(FP), R0 // a1 42 MOVW a2+8(FP), R1 // a2 43 MOVW a3+12(FP), R2 // a3 44 MOVW a4+16(FP), R3 // a4 45 MOVW R13, R4 46 MOVW $a5+20(FP), R13 // a5 to a6 are passed on stack 47 SWI $0 // syscall 48 MOVW R4, R13 49 MOVW $0, R2 50 BCS error6 51 MOVW R0, r1+28(FP) // r1 52 MOVW R1, r2+32(FP) // r2 53 MOVW R2, err+36(FP) // errno 54 BL runtime·exitsyscall(SB) 55 RET 56 error6: 57 MOVW $-1, R3 58 MOVW R3, r1+28(FP) // r1 59 MOVW R2, r2+32(FP) // r2 60 MOVW R0, err+36(FP) // errno 61 BL runtime·exitsyscall(SB) 62 RET 63 64 TEXT ·Syscall9(SB),NOSPLIT,$0-52 65 BL runtime·entersyscall(SB) 66 MOVW num+0(FP), R7 // syscall number 67 MOVW a1+4(FP), R0 // a1 68 MOVW a2+8(FP), R1 // a2 69 MOVW a3+12(FP), R2 // a3 70 MOVW a4+16(FP), R3 // a4 71 MOVW R13, R4 72 MOVW $a5+20(FP), R13 // a5 to a9 are passed on stack 73 SWI $0 // syscall 74 MOVW R4, R13 75 MOVW $0, R2 76 BCS error9 77 MOVW R0, r1+40(FP) // r1 78 MOVW R1, r2+44(FP) // r2 79 MOVW R2, err+48(FP) // errno 80 BL runtime·exitsyscall(SB) 81 RET 82 error9: 83 MOVW $-1, R3 84 MOVW R3, r1+40(FP) // r1 85 MOVW R2, r2+44(FP) // r2 86 MOVW R0, err+48(FP) // errno 87 BL runtime·exitsyscall(SB) 88 RET 89 90 TEXT ·RawSyscall(SB),NOSPLIT,$0-28 91 MOVW trap+0(FP), R7 // syscall number 92 MOVW a1+4(FP), R0 // a1 93 MOVW a2+8(FP), R1 // a2 94 MOVW a3+12(FP), R2 // a3 95 SWI $0 // syscall 96 MOVW $0, R2 97 BCS errorr 98 MOVW R0, r1+16(FP) // r1 99 MOVW R1, r2+20(FP) // r2 100 MOVW R2, err+24(FP) // errno 101 RET 102 errorr: 103 MOVW $-1, R3 104 MOVW R3, r1+16(FP) // r1 105 MOVW R2, r2+20(FP) // r2 106 MOVW R0, err+24(FP) // errno 107 RET 108 109 TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 110 MOVW trap+0(FP), R7 // syscall number 111 MOVW a1+4(FP), R0 // a1 112 MOVW a2+8(FP), R1 // a2 113 MOVW a3+12(FP), R2 // a3 114 MOVW a4+16(FP), R3 // a4 115 MOVW R13, R4 116 MOVW $a5+20(FP), R13 // a5 to a6 are passed on stack 117 SWI $0 // syscall 118 MOVW R4, R13 119 MOVW $0, R2 120 BCS errorr6 121 MOVW R0, r1+28(FP) // r1 122 MOVW R1, r2+32(FP) // r2 123 MOVW R2, err+36(FP) // errno 124 RET 125 errorr6: 126 MOVW $-1, R3 127 MOVW R3, r1+28(FP) // r1 128 MOVW R2, r2+32(FP) // r2 129 MOVW R0, err+36(FP) // errno 130 RET