github.com/s1s1ty/go@v0.0.0-20180207192209-104445e3140f/src/syscall/asm_nacl_amd64p32.s (about) 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 #include "../runtime/syscall_nacl.h" 8 9 // 10 // System call support for amd64, Native Client 11 // 12 13 #define NACL_SYSCALL(code) \ 14 MOVL $(0x10000 + ((code)<<5)), AX; CALL AX 15 16 #define NACL_SYSJMP(code) \ 17 MOVL $(0x10000 + ((code)<<5)), AX; JMP AX 18 19 TEXT ·Syscall(SB),NOSPLIT,$0-28 20 CALL runtime·entersyscall(SB) 21 MOVL trap+0(FP), AX 22 MOVL a1+4(FP), DI 23 MOVL a2+8(FP), SI 24 MOVL a3+12(FP), DX 25 // more args would use CX, R8, R9 26 SHLL $5, AX 27 ADDL $0x10000, AX 28 CALL AX 29 CMPL AX, $0 30 JGE ok 31 MOVL $-1, r1+16(FP) 32 MOVL $-1, r2+20(FP) 33 NEGL AX 34 MOVL AX, err+24(FP) 35 CALL runtime·exitsyscall(SB) 36 RET 37 ok: 38 MOVL AX, r1+16(FP) 39 MOVL DX, r2+20(FP) 40 MOVL $0, err+24(FP) 41 CALL runtime·exitsyscall(SB) 42 RET