Home | History | Annotate | Download | only in syscall
      1 // Copyright 2014 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 call support for ARM, Darwin
      9 //
     10 
     11 // func Syscall(syscall uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr)
     12 TEXT	Syscall(SB),NOSPLIT,$0-28
     13 	BL		runtimeentersyscall(SB)
     14 	MOVW	syscall+4(SP), R12
     15 	MOVW	a1+8(SP), R0
     16 	MOVW	a2+12(SP), R1
     17 	MOVW	a3+16(SP), R2
     18 	SWI		$0x80
     19 	BCC		ok
     20 	MOVW	$-1, R1
     21 	MOVW	R1, r1+20(SP)	// r1
     22 	MOVW	$0, R2
     23 	MOVW	R2, r2+24(SP)	// r2
     24 	MOVW	R0, errno+28(SP)	// errno
     25 	BL		runtimeexitsyscall(SB)
     26 	RET
     27 ok:
     28 	MOVW	R0, r1+20(SP) // r1
     29 	MOVW	R1, r2+24(SP)	// r2
     30 	MOVW	$0, R0
     31 	MOVW	R0, errno+28(SP)	// errno
     32 	BL		runtimeexitsyscall(SB)
     33 	RET
     34 
     35 // func RawSyscall(trap uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr)
     36 TEXT RawSyscall(SB),NOSPLIT,$0-28
     37 	MOVW	syscall+4(SP), R12	// syscall entry
     38 	MOVW	a1+8(SP), R0
     39 	MOVW	a2+12(SP), R1
     40 	MOVW	a3+16(SP), R2
     41 	SWI		$0x80
     42 	BCC		ok1
     43 	MOVW	$-1, R1
     44 	MOVW	R1, r1+20(SP)	// r1
     45 	MOVW	$0, R2
     46 	MOVW	R2, r2+24(SP)	// r2
     47 	MOVW	R0, errno+28(SP)	// errno
     48 	RET
     49 ok1:
     50 	MOVW	R0, r1+20(SP) // r1
     51 	MOVW	R1, r2+24(SP)	// r2
     52 	MOVW	$0, R0
     53 	MOVW	R0, errno+28(SP)	// errno
     54 	RET
     55 
     56 // func Syscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
     57 TEXT	Syscall6(SB),NOSPLIT,$0-40
     58 	BL		runtimeentersyscall(SB)
     59 	MOVW	syscall+4(SP), R12	// syscall entry
     60 	MOVW	a1+8(SP), R0
     61 	MOVW	a2+12(SP), R1
     62 	MOVW	a3+16(SP), R2
     63 	MOVW	a4+20(SP), R3
     64 	MOVW	a5+24(SP), R4
     65 	MOVW	a6+28(SP), R5
     66 	SWI		$0x80
     67 	BCC		ok6
     68 	MOVW	$-1, R1
     69 	MOVW	R1, r1+32(SP)	// r1
     70 	MOVW	$0, R2
     71 	MOVW	R2, r2+36(SP)	// r2
     72 	MOVW	R0, errno+40(SP)	// errno
     73 	BL		runtimeexitsyscall(SB)
     74 	RET
     75 ok6:
     76 	MOVW	R0, r1+32(SP) // r1
     77 	MOVW	R1, r2+36(SP)	// r2
     78 	MOVW	$0, R0
     79 	MOVW	R0, errno+40(SP)	// errno
     80 	BL		runtimeexitsyscall(SB)
     81 	RET
     82 
     83 // func RawSyscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
     84 TEXT	RawSyscall6(SB),NOSPLIT,$0-40
     85 	MOVW	trap+4(SP), R12	// syscall entry
     86 	MOVW	a1+8(SP), R0
     87 	MOVW	a2+12(SP), R1
     88 	MOVW	a3+16(SP), R2
     89 	MOVW	a4+20(SP), R3
     90 	MOVW	a5+24(SP), R4
     91 	MOVW	a6+28(SP), R5
     92 	SWI		$0x80
     93 	BCC		ok2
     94 	MOVW	$-1, R1
     95 	MOVW	R1, r1+32(SP)	// r1
     96 	MOVW	$0, R2
     97 	MOVW	R2, r2+36(SP)	// r2
     98 	MOVW	R0, errno+40(SP)	// errno
     99 	RET
    100 ok2:
    101 	MOVW	R0, r1+32(SP) // r1
    102 	MOVW	R1, r2+36(SP)	// r2
    103 	MOVW	$0, R0
    104 	MOVW	R0, errno+40(SP)	// errno
    105 	RET
    106 
    107 // Actually Syscall7.
    108 TEXT	Syscall9(SB),NOSPLIT,$0-52
    109 	BL runtimeentersyscall(SB)
    110 	MOVW	syscall+4(SP), R12	// syscall entry
    111 	MOVW	a1+8(SP), R0
    112 	MOVW	a2+12(SP), R1
    113 	MOVW	a3+16(SP), R2
    114 	MOVW	a4+20(SP), R3
    115 	MOVW	a5+24(SP), R4
    116 	MOVW	a6+28(SP), R5
    117 	MOVW	a7+32(SP), R6
    118 	SWI		$0x80
    119 	BCC		ok9
    120 	MOVW	$-1, R1
    121 	MOVW	R1, r1+44(SP)	// r1
    122 	MOVW	$0, R2
    123 	MOVW	R2, r2+48(SP)	// r2
    124 	MOVW	R0, errno+52(SP)	// errno
    125 	BL		runtimeexitsyscall(SB)
    126 	RET
    127 ok9:
    128 	MOVW	R0, r1+44(SP) // r1
    129 	MOVW	R1, r2+48(SP)	// r2
    130 	MOVW	$0, R0
    131 	MOVW	R0, errno+52(SP)	// errno
    132 	BL	runtimeexitsyscall(SB)
    133 	RET
    134 
    135