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 #include "funcdata.h"
      7 #include "../runtime/syscall_nacl.h"
      8 
      9 //
     10 // System call support for ARM, Native Client
     11 //
     12 
     13 #define NACL_SYSCALL(code) \
     14 	MOVW $(0x10000 + ((code)<<5)), R8; BL (R8)
     15 
     16 #define NACL_SYSJMP(code) \
     17 	MOVW $(0x10000 + ((code)<<5)), R8; B (R8)
     18 
     19 TEXT Syscall(SB),NOSPLIT,$0-28
     20 	BL	runtimeentersyscall(SB)
     21 	MOVW	trap+0(FP), R8
     22 	MOVW	a1+4(FP), R0
     23 	MOVW	a2+8(FP), R1
     24 	MOVW	a3+12(FP), R2
     25 	// more args would use R3, and then stack.
     26 	MOVW	$0x10000, R7
     27 	ADD	R8<<5, R7
     28 	BL	(R7)
     29 	CMP	$0, R0
     30 	BGE	ok
     31 	MOVW	$-1, R1
     32 	MOVW	R1, r1+16(FP)
     33 	MOVW	R1, r2+20(FP)
     34 	RSB	$0, R0
     35 	MOVW	R0, err+24(FP)
     36 	BL	runtimeexitsyscall(SB)
     37 	RET
     38 ok:
     39 	MOVW	R0, r1+16(FP)
     40 	MOVW	R1, r2+20(FP)
     41 	MOVW	$0, R2
     42 	MOVW	R2, err+24(FP)
     43 	BL	runtimeexitsyscall(SB)
     44 	RET
     45