Black Lives Matter. Support the Equal Justice Initiative.

Text file src/syscall/asm_darwin_amd64.s

Documentation: syscall

     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 call support for AMD64, Darwin
    10//
    11
    12// Trap # in AX, args in DI SI DX, return in AX DX
    13
    14// func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno);
    15TEXT	·Syscall(SB),NOSPLIT,$0-56
    16	CALL	runtime·entersyscall(SB)
    17	MOVQ	a1+8(FP), DI
    18	MOVQ	a2+16(FP), SI
    19	MOVQ	a3+24(FP), DX
    20	MOVQ	trap+0(FP), AX	// syscall entry
    21	ADDQ	$0x2000000, AX
    22	SYSCALL
    23	JCC	ok
    24	MOVQ	$-1, r1+32(FP)
    25	MOVQ	$0, r2+40(FP)
    26	MOVQ	AX, err+48(FP)
    27	CALL	runtime·exitsyscall(SB)
    28	RET
    29ok:
    30	MOVQ	AX, r1+32(FP)
    31	MOVQ	DX, r2+40(FP)
    32	MOVQ	$0, err+48(FP)
    33	CALL	runtime·exitsyscall(SB)
    34	RET
    35
    36// func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno);
    37TEXT	·Syscall6(SB),NOSPLIT,$0-80
    38	CALL	runtime·entersyscall(SB)
    39	MOVQ	a1+8(FP), DI
    40	MOVQ	a2+16(FP), SI
    41	MOVQ	a3+24(FP), DX
    42	MOVQ	a4+32(FP), R10
    43	MOVQ	a5+40(FP), R8
    44	MOVQ	a6+48(FP), R9
    45	MOVQ	trap+0(FP), AX	// syscall entry
    46	ADDQ	$0x2000000, AX
    47	SYSCALL
    48	JCC	ok6
    49	MOVQ	$-1, r1+56(FP)
    50	MOVQ	$0, r2+64(FP)
    51	MOVQ	AX, err+72(FP)
    52	CALL	runtime·exitsyscall(SB)
    53	RET
    54ok6:
    55	MOVQ	AX, r1+56(FP)
    56	MOVQ	DX, r2+64(FP)
    57	MOVQ	$0, err+72(FP)
    58	CALL	runtime·exitsyscall(SB)
    59	RET
    60
    61// func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno)
    62TEXT	·Syscall9(SB),NOSPLIT,$0-104
    63	CALL	runtime·entersyscall(SB)
    64	MOVQ	trap+0(FP), AX	// syscall entry
    65	MOVQ	a1+8(FP), DI
    66	MOVQ	a2+16(FP), SI
    67	MOVQ	a3+24(FP), DX
    68	MOVQ	a4+32(FP), R10
    69	MOVQ	a5+40(FP), R8
    70	MOVQ	a6+48(FP), R9
    71	MOVQ	a7+56(FP), R11
    72	MOVQ	a8+64(FP), R12
    73	MOVQ	a9+72(FP), R13
    74	SUBQ	$32, SP
    75	MOVQ	R11, 8(SP)
    76	MOVQ	R12, 16(SP)
    77	MOVQ	R13, 24(SP)
    78	ADDQ	$0x2000000, AX
    79	SYSCALL
    80	JCC	ok9
    81	ADDQ	$32, SP
    82	MOVQ	$-1, r1+80(FP)
    83	MOVQ	$0, r2+88(FP)
    84	MOVQ	AX, err+96(FP)
    85	CALL	runtime·exitsyscall(SB)
    86	RET
    87ok9:
    88	ADDQ	$32, SP
    89	MOVQ	AX, r1+80(FP)
    90	MOVQ	DX, r2+88(FP)
    91	MOVQ	$0, err+96(FP)
    92	CALL	runtime·exitsyscall(SB)
    93	RET
    94
    95// func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
    96TEXT ·RawSyscall(SB),NOSPLIT,$0-56
    97	MOVQ	a1+8(FP), DI
    98	MOVQ	a2+16(FP), SI
    99	MOVQ	a3+24(FP), DX
   100	MOVQ	trap+0(FP), AX	// syscall entry
   101	ADDQ	$0x2000000, AX
   102	SYSCALL
   103	JCC	ok1
   104	MOVQ	$-1, r1+32(FP)
   105	MOVQ	$0, r2+40(FP)
   106	MOVQ	AX, err+48(FP)
   107	RET
   108ok1:
   109	MOVQ	AX, r1+32(FP)
   110	MOVQ	DX, r2+40(FP)
   111	MOVQ	$0, err+48(FP)
   112	RET
   113
   114// func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
   115TEXT	·RawSyscall6(SB),NOSPLIT,$0-80
   116	MOVQ	a1+8(FP), DI
   117	MOVQ	a2+16(FP), SI
   118	MOVQ	a3+24(FP), DX
   119	MOVQ	a4+32(FP), R10
   120	MOVQ	a5+40(FP), R8
   121	MOVQ	a6+48(FP), R9
   122	MOVQ	trap+0(FP), AX	// syscall entry
   123	ADDQ	$0x2000000, AX
   124	SYSCALL
   125	JCC	ok2
   126	MOVQ	$-1, r1+56(FP)
   127	MOVQ	$0, r2+64(FP)
   128	MOVQ	AX, err+72(FP)
   129	RET
   130ok2:
   131	MOVQ	AX, r1+56(FP)
   132	MOVQ	DX, r2+64(FP)
   133	MOVQ	$0, err+72(FP)
   134	RET

View as plain text