...

Text file src/syscall/asm_nacl_386.s

Documentation: 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#include "../runtime/syscall_nacl.h"
     8
     9//
    10// System call support for 386, 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
    19TEXT ·Syscall(SB),NOSPLIT,$12-28
    20	NO_LOCAL_POINTERS
    21	CALL	runtime·entersyscall(SB)
    22	MOVL	trap+0(FP), AX
    23	MOVL	a1+4(FP), BX
    24	MOVL	BX, 0(SP)
    25	MOVL	a2+8(FP), BX
    26	MOVL	BX, 4(SP)
    27	MOVL	a3+12(FP), BX
    28	MOVL	BX, 8(SP)
    29	SHLL	$5, AX
    30	ADDL	$0x10000, AX
    31	CALL	AX
    32	CMPL	AX, $0
    33	JGE	ok
    34	MOVL	$-1, r1+16(FP)
    35	MOVL	$-1, r2+20(FP)
    36	NEGL	AX
    37	MOVL	AX, err+24(FP)
    38	CALL	runtime·exitsyscall(SB)
    39	RET
    40ok:
    41	MOVL	AX, r1+16(FP)
    42	MOVL	DX, r2+20(FP)
    43	MOVL	$0, err+24(FP)
    44	CALL	runtime·exitsyscall(SB)
    45	RET

View as plain text