github.com/emc-advanced-dev/unik@v0.0.0-20190717152701-a58d3e8e33b7/containers/compilers/rump/go/gopatches/syscall/asm_rumprun_amd64.s (about)

     1  // Copyright 2009 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  // TODO(rsc): Rewrite all nn(SP) references into name+(nn-8)(FP)
     6  // so that go vet can check that they are correct.
     7  
     8  #include "textflag.h"
     9  #include "funcdata.h"
    10  
    11  //
    12  // System call support for AMD64, NetBSD
    13  //
    14  
    15  // func Syscall(trap int64, a1, a2, a3 int64) (r1, r2, err int64);
    16  // func Syscall6(trap int64, a1, a2, a3, a4, a5, a6 int64) (r1, r2, err int64);
    17  // Trap # in AX, args in DI SI DX, return in AX DX
    18  
    19  TEXT	·Syscall(SB),NOSPLIT,$0-56
    20      JMP	runtime·ksyscall(SB)
    21  
    22  
    23  TEXT	·Syscall6(SB),NOSPLIT,$0-80
    24  	CALL	runtime·entersyscall(SB)
    25  	MOVQ	8(SP), DI
    26  	MOVQ	SP, SI
    27  	ADDQ	$16, SI
    28  	MOVQ	$0, DX		// dlen is ignored for local calls
    29  	MOVQ	SP, CX
    30  	ADDQ	$64, CX
    31  	LEAQ	rump_syscall(SB), AX
    32  	CALL	AX
    33  	TESTQ	AX, AX
    34  	JE	ok6
    35  	MOVQ	AX, 80(SP)  	// errno
    36  	CALL	runtime·exitsyscall(SB)
    37  	RET
    38  ok6:
    39  	MOVQ	$0, 80(SP)	// errno
    40  	CALL	runtime·exitsyscall(SB)
    41  	RET
    42  
    43  TEXT	·RawSyscall(SB),NOSPLIT,$0-56
    44  	MOVQ	8(SP), DI
    45  	MOVQ	SP, SI
    46  	ADDQ	$16, SI
    47  	MOVQ	$0, DX		// dlen is ignored for local calls
    48  	MOVQ	SP, CX
    49  	ADDQ	$40, CX
    50  	LEAQ	rump_syscall(SB), AX
    51  	CALL	AX
    52  	TESTQ	AX, AX
    53  	JE	ok1
    54  	MOVQ	AX, 56(SP)	// errno
    55  	RET
    56  ok1:
    57  	MOVQ	$0, 56(SP)	// errno
    58  	RET
    59  
    60  TEXT	·RawSyscall6(SB),NOSPLIT,$0-80
    61  	MOVQ	8(SP), DI
    62  	MOVQ	SP, SI
    63  	ADDQ	$16, SI
    64  	MOVQ	$0, DX		// dlen is ignored for local calls
    65  	MOVQ	SP, CX
    66  	ADDQ	$64, CX
    67  	LEAQ	rump_syscall(SB), AX
    68  	CALL	AX
    69  	TESTQ	AX, AX
    70  	JE	ok1
    71  	MOVQ	AX, 80(SP)	// errno
    72  	RET
    73  ok1:
    74  	MOVQ	$0, 80(SP)	// errno
    75  	RET