...
Run Format

Text file src/runtime/cgo/gcc_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	/*
     6	 * void crosscall_s390x(void (*fn)(void), void *g)
     7	 *
     8	 * Calling into the go tool chain, where all registers are caller save.
     9	 * Called from standard s390x C ABI, where r6-r13, r15, and f8-f15 are
    10	 * callee-save, so they must be saved explicitly.
    11	 */
    12	.globl crosscall_s390x
    13	crosscall_s390x:
    14		/* save r6-r15 in the register save area of the calling function */
    15		stmg    %r6, %r15, 48(%r15)
    16	
    17		/* allocate 64 bytes of stack space to save f8-f15 */
    18		lay     %r15, -64(%r15)
    19	
    20		/* save callee-saved floating point registers */
    21		std     %f8, 0(%r15)
    22		std     %f9, 8(%r15)
    23		std     %f10, 16(%r15)
    24		std     %f11, 24(%r15)
    25		std     %f12, 32(%r15)
    26		std     %f13, 40(%r15)
    27		std     %f14, 48(%r15)
    28		std     %f15, 56(%r15)
    29	
    30		/* restore g pointer */
    31		lgr     %r13, %r3
    32	
    33		/* call fn */
    34		basr    %r14, %r2
    35	
    36		/* restore floating point registers */
    37		ld      %f8, 0(%r15)
    38		ld      %f9, 8(%r15)
    39		ld      %f10, 16(%r15)
    40		ld      %f11, 24(%r15)
    41		ld      %f12, 32(%r15)
    42		ld      %f13, 40(%r15)
    43		ld      %f14, 48(%r15)
    44		ld      %f15, 56(%r15)
    45	
    46		/* de-allocate stack frame */
    47		la      %r15, 64(%r15)
    48	
    49		/* restore general purpose registers */
    50		lmg     %r6, %r15, 48(%r15)
    51	
    52		br      %r14 /* restored by lmg */
    53	
    54	#ifdef __ELF__
    55	.section .note.GNU-stack,"",%progbits
    56	#endif

View as plain text