...
Run Format

Text file src/syscall/asm_linux_s390x.s

Documentation: syscall

     1// Copyright 2016 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//
     8// System calls for s390x, Linux
     9//
    10
    11// func Syscall(trap int64, a1, a2, a3 int64) (r1, r2, err int64)
    12TEXT ·Syscall(SB),NOSPLIT,$0-56
    13	BL	runtime·entersyscall(SB)
    14	MOVD	a1+8(FP), R2
    15	MOVD	a2+16(FP), R3
    16	MOVD	a3+24(FP), R4
    17	MOVD	$0, R5
    18	MOVD	$0, R6
    19	MOVD	$0, R7
    20	MOVD	trap+0(FP), R1	// syscall entry
    21	SYSCALL
    22	MOVD	$0xfffffffffffff001, R8
    23	CMPUBLT	R2, R8, ok
    24	MOVD	$-1, r1+32(FP)
    25	MOVD	$0, r2+40(FP)
    26	NEG	R2, R2
    27	MOVD	R2, err+48(FP)	// errno
    28	BL	runtime·exitsyscall(SB)
    29	RET
    30ok:
    31	MOVD	R2, r1+32(FP)
    32	MOVD	R3, r2+40(FP)
    33	MOVD	$0, err+48(FP)	// errno
    34	BL	runtime·exitsyscall(SB)
    35	RET
    36
    37// func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
    38TEXT ·Syscall6(SB),NOSPLIT,$0-80
    39	BL	runtime·entersyscall(SB)
    40	MOVD	a1+8(FP), R2
    41	MOVD	a2+16(FP), R3
    42	MOVD	a3+24(FP), R4
    43	MOVD	a4+32(FP), R5
    44	MOVD	a5+40(FP), R6
    45	MOVD	a6+48(FP), R7
    46	MOVD	trap+0(FP), R1	// syscall entry
    47	SYSCALL
    48	MOVD	$0xfffffffffffff001, R8
    49	CMPUBLT	R2, R8, ok6
    50	MOVD	$-1, r1+56(FP)
    51	MOVD	$0, r2+64(FP)
    52	NEG	R2, R2
    53	MOVD	R2, err+72(FP)	// errno
    54	BL	runtime·exitsyscall(SB)
    55	RET
    56ok6:
    57	MOVD	R2, r1+56(FP)
    58	MOVD	R3, r2+64(FP)
    59	MOVD	$0, err+72(FP)	// errno
    60	BL	runtime·exitsyscall(SB)
    61	RET
    62
    63// func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
    64TEXT ·RawSyscall(SB),NOSPLIT,$0-56
    65	MOVD	a1+8(FP), R2
    66	MOVD	a2+16(FP), R3
    67	MOVD	a3+24(FP), R4
    68	MOVD	$0, R5
    69	MOVD	$0, R6
    70	MOVD	$0, R7
    71	MOVD	trap+0(FP), R1	// syscall entry
    72	SYSCALL
    73	MOVD	$0xfffffffffffff001, R8
    74	CMPUBLT	R2, R8, ok1
    75	MOVD	$-1, r1+32(FP)
    76	MOVD	$0, r2+40(FP)
    77	NEG	R2, R2
    78	MOVD	R2, err+48(FP)	// errno
    79	RET
    80ok1:
    81	MOVD	R2, r1+32(FP)
    82	MOVD	R3, r2+40(FP)
    83	MOVD	$0, err+48(FP)	// errno
    84	RET
    85
    86// func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
    87TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
    88	MOVD	a1+8(FP), R2
    89	MOVD	a2+16(FP), R3
    90	MOVD	a3+24(FP), R4
    91	MOVD	a4+32(FP), R5
    92	MOVD	a5+40(FP), R6
    93	MOVD	a6+48(FP), R7
    94	MOVD	trap+0(FP), R1	// syscall entry
    95	SYSCALL
    96	MOVD	$0xfffffffffffff001, R8
    97	CMPUBLT	R2, R8, ok2
    98	MOVD	$-1, r1+56(FP)
    99	MOVD	$0, r2+64(FP)
   100	NEG	R2, R2
   101	MOVD	R2, err+72(FP)	// errno
   102	RET
   103ok2:
   104	MOVD	R2, r1+56(FP)
   105	MOVD	R3, r2+64(FP)
   106	MOVD	$0, err+72(FP)	// errno
   107	RET
   108
   109// func rawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr)
   110TEXT ·rawSyscallNoError(SB),NOSPLIT,$0-48
   111	MOVD	a1+8(FP), R2
   112	MOVD	a2+16(FP), R3
   113	MOVD	a3+24(FP), R4
   114	MOVD	$0, R5
   115	MOVD	$0, R6
   116	MOVD	$0, R7
   117	MOVD	trap+0(FP), R1	// syscall entry
   118	SYSCALL
   119	MOVD	R2, r1+32(FP)
   120	MOVD	R3, r2+40(FP)
   121	RET
   122
   123#define SYS_SOCKETCALL 102	/* from zsysnum_linux_s390x.go */
   124
   125// func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err int)
   126// Kernel interface gets call sub-number and pointer to a0.
   127TEXT ·socketcall(SB),NOSPLIT,$0-72
   128	BL	runtime·entersyscall(SB)
   129	MOVD	$SYS_SOCKETCALL, R1	// syscall entry
   130	MOVD	call+0(FP), R2		// socket call number
   131	MOVD	$a0+8(FP), R3		// pointer to call arguments
   132	MOVD	$0, R4
   133	MOVD	$0, R5
   134	MOVD	$0, R6
   135	MOVD	$0, R7
   136	SYSCALL
   137	MOVD	$0xfffffffffffff001, R8
   138	CMPUBLT	R2, R8, oksock
   139	MOVD	$-1, n+56(FP)
   140	NEG	R2, R2
   141	MOVD	R2, err+64(FP)
   142	BL	runtime·exitsyscall(SB)
   143	RET
   144oksock:
   145	MOVD	R2, n+56(FP)
   146	MOVD	$0, err+64(FP)
   147	CALL	runtime·exitsyscall(SB)
   148	RET
   149
   150// func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err int)
   151// Kernel interface gets call sub-number and pointer to a0.
   152TEXT ·rawsocketcall(SB),NOSPLIT,$0-72
   153	MOVD	$SYS_SOCKETCALL, R1	// syscall entry
   154	MOVD	call+0(FP), R2		// socket call number
   155	MOVD	$a0+8(FP), R3		// pointer to call arguments
   156	MOVD	$0, R4
   157	MOVD	$0, R5
   158	MOVD	$0, R6
   159	MOVD	$0, R7
   160	SYSCALL
   161	MOVD	$0xfffffffffffff001, R8
   162	CMPUBLT	R2, R8, oksock1
   163	MOVD	$-1, n+56(FP)
   164	NEG	R2, R2
   165	MOVD	R2, err+64(FP)
   166	RET
   167oksock1:
   168	MOVD	R2, n+56(FP)
   169	MOVD	$0, err+64(FP)
   170	RET

View as plain text