github.com/mh-cbon/go@v0.0.0-20160603070303-9e112a3fe4c0/src/runtime/cgo/gcc_s390x.S (about)

     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 f0, f2, f4 and f6 are
    10   * callee-save, so they must be saved explicitly.
    11   */
    12  .globl crosscall_s390x
    13  crosscall_s390x:
    14  	/*
    15  	 * save r6-r15, f0, f2, f4 and f6 in the
    16  	 * register save area of the calling function
    17  	 */
    18  	stmg	%r6, %r15, 48(%r15)
    19  	stdy	%f0, 128(%r15)
    20  	stdy	%f2, 136(%r15)
    21  	stdy	%f4, 144(%r15)
    22  	stdy	%f6, 152(%r15)
    23  
    24  	/* assumes this call does not clobber r2 or r15 */
    25  	xgr	%r0, %r0
    26  
    27  	/* grow stack 8 bytes and call fn */
    28  	agfi    %r15, -8
    29  	basr    %r14, %r2
    30  	agfi	%r15, 8
    31  
    32  	/* restore registers */
    33  	lmg	%r6, %r15, 48(%r15)
    34  	ldy	%f0, 128(%r15)
    35  	ldy	%f2, 136(%r15)
    36  	ldy	%f4, 144(%r15)
    37  	ldy	%f6, 152(%r15)
    38  
    39  	br      %r14 /* restored by lmg */
    40  
    41  #ifdef __ELF__
    42  .section .note.GNU-stack,"",%progbits
    43  #endif