Home | History | Annotate | Download | only in syscall
      1 // Copyright 2013 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, NetBSD
     10 //
     11 
     12 // func Syscall(trap int32, a1, a2, a3 int32) (r1, r2, err int32);
     13 // func Syscall6(trap int32, a1, a2, a3, a4, a5, a6 int32) (r1, r2, err int32);
     14 // func Syscall9(trap int32, a1, a2, a3, a4, a5, a6, a7, a8, a9 int64) (r1, r2, err int32)
     15 
     16 TEXT	Syscall(SB),NOSPLIT,$0-28
     17 	BL runtimeentersyscall(SB)
     18 	MOVW trap+0(FP), R0 // sigcall num
     19 	MOVW a1+4(FP), R1 // a1
     20 	MOVW a2+8(FP), R2 // a2
     21 	MOVW a3+12(FP), R3 // 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) // err
     28 	BL runtimeexitsyscall(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) // err
     35 	BL runtimeexitsyscall(SB)
     36 	RET
     37 
     38 TEXT	Syscall6(SB),NOSPLIT,$0-40
     39 	BL runtimeentersyscall(SB)
     40 	MOVW trap+0(FP), R0 // sigcall num
     41 	MOVW a1+4(FP), R1 // a1
     42 	MOVW a2+8(FP), R2 // a2
     43 	MOVW a3+12(FP), R3 // a3
     44 	MOVW R13, R4
     45 	MOVW $a4+16(FP), R13 // a4 to a6 are passed on stack
     46 	SWI $0 // syscall
     47 	MOVW R4, R13
     48 	MOVW $0, R2
     49 	BCS error6
     50 	MOVW R0, r1+28(FP) // r1
     51 	MOVW R1, r2+32(FP) // r2
     52 	MOVW R2, err+36(FP) // err
     53 	BL runtimeexitsyscall(SB)
     54 	RET
     55 error6:
     56 	MOVW $-1, R3
     57 	MOVW R3, r1+28(FP) // r1
     58 	MOVW R2, r2+32(FP) // r2
     59 	MOVW R0, err+36(FP) // err
     60 	BL runtimeexitsyscall(SB)
     61 	RET
     62 
     63 TEXT	Syscall9(SB),NOSPLIT,$0-52
     64 	BL runtimeentersyscall(SB)
     65 	MOVW trap+0(FP), R0 // sigcall num
     66 	MOVW a1+4(FP), R1 // a1
     67 	MOVW a2+8(FP), R2 // a2
     68 	MOVW a3+12(FP), R3 // a3
     69 	MOVW R13, R4
     70 	MOVW $a4+16(FP), R13 // a4 to a9 are passed on stack
     71 	SWI $0 // syscall
     72 	MOVW R4, R13
     73 	MOVW $0, R2
     74 	BCS error9
     75 	MOVW R0, r1+40(FP) // r1
     76 	MOVW R1, r2+44(FP) // r2
     77 	MOVW R2, err+48(FP) // err
     78 	BL runtimeexitsyscall(SB)
     79 	RET
     80 error9:
     81 	MOVW $-1, R3
     82 	MOVW R3, r1+40(FP) // r1
     83 	MOVW R2, r2+44(FP) // r2
     84 	MOVW R0, err+48(FP) // err
     85 	BL runtimeexitsyscall(SB)
     86 	RET
     87 
     88 TEXT	RawSyscall(SB),NOSPLIT,$0-28
     89 	MOVW trap+0(FP), R0 // sigcall num
     90 	MOVW a1+4(FP), R1 // a1
     91 	MOVW a2+8(FP), R2 // a2
     92 	MOVW a3+12(FP), R3 // a3
     93 	SWI $0 // syscall
     94 	MOVW $0, R2
     95 	BCS errorr
     96 	MOVW R0, r1+16(FP) // r1
     97 	MOVW R1, r2+20(FP) // r2
     98 	MOVW R2, err+24(FP) // err
     99 	RET
    100 errorr:
    101 	MOVW $-1, R3
    102 	MOVW R3, r1+16(FP) // r1
    103 	MOVW R2, r2+20(FP) // r2
    104 	MOVW R0, err+24(FP) // err
    105 	RET
    106 
    107 TEXT	RawSyscall6(SB),NOSPLIT,$0-40
    108 	MOVW trap+0(FP), R0 // sigcall num
    109 	MOVW a1+4(FP), R1 // a1
    110 	MOVW a2+8(FP), R2 // a2
    111 	MOVW a3+12(FP), R3 // a3
    112 	MOVW R13, R4
    113 	MOVW $a4+16(FP), R13 // a4 to a9 are passed on stack
    114 	SWI $0 // syscall
    115 	MOVW R4, R13
    116 	MOVW $0, R2
    117 	BCS errorr6
    118 	MOVW R0, r1+28(FP) // r1
    119 	MOVW R1, r2+32(FP) // r2
    120 	MOVW R2, err+36(FP) // err
    121 	RET
    122 errorr6:
    123 	MOVW $-1, R3
    124 	MOVW R3, r1+28(FP) // r1
    125 	MOVW R2, r2+32(FP) // r2
    126 	MOVW R0, err+36(FP) // err
    127 	RET
    128