Black Lives Matter. Support the Equal Justice Initiative.

Text file src/syscall/asm_openbsd_arm64.s

Documentation: syscall

     1// Copyright 2019 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
     7// See comment in runtime/sys_openbsd_arm64.s re this construction.
     8#define	INVOKE_SYSCALL	\
     9	SVC;		\
    10	NOOP;		\
    11	NOOP
    12
    13// func Syscall(trap int64, a1, a2, a3 int64) (r1, r2, err int64);
    14TEXT ·Syscall(SB),NOSPLIT,$0-56
    15	BL	runtime·entersyscall(SB)
    16	MOVD	a1+8(FP), R0
    17	MOVD	a2+16(FP), R1
    18	MOVD	a3+24(FP), R2
    19	MOVD	$0, R3
    20	MOVD	$0, R4
    21	MOVD	$0, R5
    22	MOVD	trap+0(FP), R8	// syscall number
    23	INVOKE_SYSCALL
    24	BCC	ok
    25	MOVD	$-1, R4
    26	MOVD	R4, r1+32(FP)	// r1
    27	MOVD	ZR, r2+40(FP)	// r2
    28	MOVD	R0, err+48(FP)	// errno
    29	BL	runtime·exitsyscall(SB)
    30	RET
    31ok:
    32	MOVD	R0, r1+32(FP)	// r1
    33	MOVD	R1, r2+40(FP)	// r2
    34	MOVD	ZR, err+48(FP)	// errno
    35	BL	runtime·exitsyscall(SB)
    36	RET
    37
    38TEXT ·Syscall6(SB),NOSPLIT,$0-80
    39	BL	runtime·entersyscall(SB)
    40	MOVD	a1+8(FP), R0
    41	MOVD	a2+16(FP), R1
    42	MOVD	a3+24(FP), R2
    43	MOVD	a4+32(FP), R3
    44	MOVD	a5+40(FP), R4
    45	MOVD	a6+48(FP), R5
    46	MOVD	trap+0(FP), R8	// syscall number
    47	INVOKE_SYSCALL
    48	BCC	ok
    49	MOVD	$-1, R4
    50	MOVD	R4, r1+56(FP)	// r1
    51	MOVD	ZR, r2+64(FP)	// r2
    52	MOVD	R0, err+72(FP)	// errno
    53	BL	runtime·exitsyscall(SB)
    54	RET
    55ok:
    56	MOVD	R0, r1+56(FP)	// r1
    57	MOVD	R1, r2+64(FP)	// r2
    58	MOVD	ZR, err+72(FP)	// errno
    59	BL	runtime·exitsyscall(SB)
    60	RET
    61
    62TEXT ·Syscall9(SB),NOSPLIT,$0-104
    63	BL	runtime·entersyscall(SB)
    64	MOVD	a1+8(FP), R0
    65	MOVD	a2+16(FP), R1
    66	MOVD	a3+24(FP), R2
    67	MOVD	a4+32(FP), R3
    68	MOVD	a5+40(FP), R4
    69	MOVD	a6+48(FP), R5
    70	MOVD	a7+56(FP), R6
    71	MOVD	a8+64(FP), R7
    72	MOVD	a9+72(FP), R8	// on stack
    73	MOVD	R8, 8(RSP)
    74	MOVD	num+0(FP), R8	// syscall number
    75	INVOKE_SYSCALL
    76	BCC	ok
    77	MOVD	$-1, R4
    78	MOVD	R4, r1+80(FP)	// r1
    79	MOVD	ZR, r2+88(FP)	// r2
    80	MOVD	R0, err+96(FP)	// errno
    81	BL	runtime·exitsyscall(SB)
    82	RET
    83ok:
    84	MOVD	R0, r1+80(FP)	// r1
    85	MOVD	R1, r2+88(FP)	// r2
    86	MOVD	ZR, err+96(FP)	// errno
    87	BL	runtime·exitsyscall(SB)
    88	RET
    89
    90TEXT ·RawSyscall(SB),NOSPLIT,$0-56
    91	MOVD	a1+8(FP), R0
    92	MOVD	a2+16(FP), R1
    93	MOVD	a3+24(FP), R2
    94	MOVD	$0, R3
    95	MOVD	$0, R4
    96	MOVD	$0, R5
    97	MOVD	trap+0(FP), R8	// syscall number
    98	INVOKE_SYSCALL
    99	BCC	ok
   100	MOVD	$-1, R4
   101	MOVD	R4, r1+32(FP)	// r1
   102	MOVD	ZR, r2+40(FP)	// r2
   103	MOVD	R0, err+48(FP)	// errno
   104	RET
   105ok:
   106	MOVD	R0, r1+32(FP)	// r1
   107	MOVD	R1, r2+40(FP)	// r2
   108	MOVD	ZR, err+48(FP)	// errno
   109	RET
   110
   111TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
   112	MOVD	a1+8(FP), R0
   113	MOVD	a2+16(FP), R1
   114	MOVD	a3+24(FP), R2
   115	MOVD	a4+32(FP), R3
   116	MOVD	a5+40(FP), R4
   117	MOVD	a6+48(FP), R5
   118	MOVD	trap+0(FP), R8	// syscall number
   119	INVOKE_SYSCALL
   120	BCC	ok
   121	MOVD	$-1, R4
   122	MOVD	R4, r1+56(FP)	// r1
   123	MOVD	ZR, r2+64(FP)	// r2
   124	MOVD	R0, err+72(FP)	// errno
   125	RET
   126ok:
   127	MOVD	R0, r1+56(FP)	// r1
   128	MOVD	R1, r2+64(FP)	// r2
   129	MOVD	ZR, err+72(FP)	// errno
   130	RET

View as plain text