Text file src/syscall/asm_linux_amd64.s

     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  #include "textflag.h"
     6  #include "funcdata.h"
     7  
     8  //
     9  // System calls for AMD64, Linux
    10  //
    11  
    12  #define SYS_gettimeofday 96
    13  
    14  // func rawVforkSyscall(trap, a1, a2, a3 uintptr) (r1, err uintptr)
    15  TEXT ·rawVforkSyscall(SB),NOSPLIT|NOFRAME,$0-48
    16  	MOVQ	a1+8(FP), DI
    17  	MOVQ	a2+16(FP), SI
    18  	MOVQ	a3+24(FP), DX
    19  	MOVQ	$0, R10
    20  	MOVQ	$0, R8
    21  	MOVQ	$0, R9
    22  	MOVQ	trap+0(FP), AX	// syscall entry
    23  	POPQ	R12 // preserve return address
    24  	SYSCALL
    25  	PUSHQ	R12
    26  	CMPQ	AX, $0xfffffffffffff001
    27  	JLS	ok2
    28  	MOVQ	$-1, r1+32(FP)
    29  	NEGQ	AX
    30  	MOVQ	AX, err+40(FP)
    31  	RET
    32  ok2:
    33  	MOVQ	AX, r1+32(FP)
    34  	MOVQ	$0, err+40(FP)
    35  	RET
    36  
    37  // func rawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr)
    38  TEXT ·rawSyscallNoError(SB),NOSPLIT,$0-48
    39  	MOVQ	a1+8(FP), DI
    40  	MOVQ	a2+16(FP), SI
    41  	MOVQ	a3+24(FP), DX
    42  	MOVQ	trap+0(FP), AX	// syscall entry
    43  	SYSCALL
    44  	MOVQ	AX, r1+32(FP)
    45  	MOVQ	DX, r2+40(FP)
    46  	RET
    47  
    48  // func gettimeofday(tv *Timeval) (err uintptr)
    49  TEXT ·gettimeofday(SB),NOSPLIT,$0-16
    50  	MOVQ	tv+0(FP), DI
    51  	MOVQ	$0, SI
    52  	MOVQ	runtime·vdsoGettimeofdaySym(SB), AX
    53  	TESTQ   AX, AX
    54  	JZ fallback
    55  	CALL	AX
    56  ret:
    57  	CMPQ	AX, $0xfffffffffffff001
    58  	JLS	ok7
    59  	NEGQ	AX
    60  	MOVQ	AX, err+8(FP)
    61  	RET
    62  fallback:
    63  	MOVL	$SYS_gettimeofday, AX
    64  	SYSCALL
    65  	JMP ret
    66  ok7:
    67  	MOVQ	$0, err+8(FP)
    68  	RET
    69  

View as plain text