...
Run Format

Text file src/runtime/cgo/asm_s390x.s

Documentation: runtime/cgo

     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	// Called by C code generated by cmd/cgo.
     8	// func crosscall2(fn func(a unsafe.Pointer, n int32, ctxt uintptr), a unsafe.Pointer, n int32, ctxt uintptr)
     9	// Saves C callee-saved registers and calls fn with three arguments.
    10	TEXT crosscall2(SB),NOSPLIT|NOFRAME,$0
    11		// Start with standard C stack frame layout and linkage.
    12	
    13		// Save R6-R15 in the register save area of the calling function.
    14		STMG	R6, R15, 48(R15)
    15	
    16		// Allocate 96 bytes on the stack.
    17		MOVD	$-96(R15), R15
    18	
    19		// Save F8-F15 in our stack frame.
    20		FMOVD	F8, 32(R15)
    21		FMOVD	F9, 40(R15)
    22		FMOVD	F10, 48(R15)
    23		FMOVD	F11, 56(R15)
    24		FMOVD	F12, 64(R15)
    25		FMOVD	F13, 72(R15)
    26		FMOVD	F14, 80(R15)
    27		FMOVD	F15, 88(R15)
    28	
    29		// Initialize Go ABI environment.
    30		BL	runtime·load_g(SB)
    31	
    32		MOVD	R3, 8(R15)  // arg1
    33		MOVW	R4, 16(R15) // arg2
    34		MOVD	R5, 24(R15) // arg3
    35		BL	(R2)        // fn(arg1, arg2, arg3)
    36	
    37		FMOVD	32(R15), F8
    38		FMOVD	40(R15), F9
    39		FMOVD	48(R15), F10
    40		FMOVD	56(R15), F11
    41		FMOVD	64(R15), F12
    42		FMOVD	72(R15), F13
    43		FMOVD	80(R15), F14
    44		FMOVD	88(R15), F15
    45	
    46		// De-allocate stack frame.
    47		MOVD	$96(R15), R15
    48	
    49		// Restore R6-R15.
    50		LMG	48(R15), R6, R15
    51	
    52		RET
    53	

View as plain text