...
Run Format

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

View as plain text