Text file src/syscall/asm_linux_s390x.s

     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 rawVforkSyscall(trap, a1 uintptr) (r1, err uintptr)
    12  TEXT ·rawVforkSyscall(SB),NOSPLIT|NOFRAME,$0-32
    13  	MOVD	$0, R2
    14  	MOVD	a1+8(FP), R3
    15  	MOVD	$0, R4
    16  	MOVD	$0, R5
    17  	MOVD	$0, R6
    18  	MOVD	$0, R7
    19  	MOVD	trap+0(FP), R1	// syscall entry
    20  	SYSCALL
    21  	MOVD	$0xfffffffffffff001, R8
    22  	CMPUBLT	R2, R8, ok2
    23  	MOVD	$-1, r1+16(FP)
    24  	NEG	R2, R2
    25  	MOVD	R2, err+24(FP)	// errno
    26  	RET
    27  ok2:
    28  	MOVD	R2, r1+16(FP)
    29  	MOVD	$0, err+24(FP)	// errno
    30  	RET
    31  
    32  // func rawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr)
    33  TEXT ·rawSyscallNoError(SB),NOSPLIT,$0-48
    34  	MOVD	a1+8(FP), R2
    35  	MOVD	a2+16(FP), R3
    36  	MOVD	a3+24(FP), R4
    37  	MOVD	$0, R5
    38  	MOVD	$0, R6
    39  	MOVD	$0, R7
    40  	MOVD	trap+0(FP), R1	// syscall entry
    41  	SYSCALL
    42  	MOVD	R2, r1+32(FP)
    43  	MOVD	R3, r2+40(FP)
    44  	RET
    45  
    46  #define SYS_SOCKETCALL 102	/* from zsysnum_linux_s390x.go */
    47  
    48  // func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err int)
    49  // Kernel interface gets call sub-number and pointer to a0.
    50  TEXT ·socketcall(SB),NOSPLIT,$0-72
    51  	BL	runtime·entersyscall(SB)
    52  	MOVD	$SYS_SOCKETCALL, R1	// syscall entry
    53  	MOVD	call+0(FP), R2		// socket call number
    54  	MOVD	$a0+8(FP), R3		// pointer to call arguments
    55  	MOVD	$0, R4
    56  	MOVD	$0, R5
    57  	MOVD	$0, R6
    58  	MOVD	$0, R7
    59  	SYSCALL
    60  	MOVD	$0xfffffffffffff001, R8
    61  	CMPUBLT	R2, R8, oksock
    62  	MOVD	$-1, n+56(FP)
    63  	NEG	R2, R2
    64  	MOVD	R2, err+64(FP)
    65  	BL	runtime·exitsyscall(SB)
    66  	RET
    67  oksock:
    68  	MOVD	R2, n+56(FP)
    69  	MOVD	$0, err+64(FP)
    70  	CALL	runtime·exitsyscall(SB)
    71  	RET
    72  
    73  // func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err int)
    74  // Kernel interface gets call sub-number and pointer to a0.
    75  TEXT ·rawsocketcall(SB),NOSPLIT,$0-72
    76  	MOVD	$SYS_SOCKETCALL, R1	// syscall entry
    77  	MOVD	call+0(FP), R2		// socket call number
    78  	MOVD	$a0+8(FP), R3		// pointer to call arguments
    79  	MOVD	$0, R4
    80  	MOVD	$0, R5
    81  	MOVD	$0, R6
    82  	MOVD	$0, R7
    83  	SYSCALL
    84  	MOVD	$0xfffffffffffff001, R8
    85  	CMPUBLT	R2, R8, oksock1
    86  	MOVD	$-1, n+56(FP)
    87  	NEG	R2, R2
    88  	MOVD	R2, err+64(FP)
    89  	RET
    90  oksock1:
    91  	MOVD	R2, n+56(FP)
    92  	MOVD	$0, err+64(FP)
    93  	RET
    94  

View as plain text