github.com/panjjo/go@v0.0.0-20161104043856-d62b31386338/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 /* set r0 to 0 */ 25 xgr %r0, %r0 26 27 /* restore g pointer */ 28 lgr %r13, %r3 29 30 /* grow stack 8 bytes and call fn */ 31 agfi %r15, -8 32 basr %r14, %r2 33 agfi %r15, 8 34 35 /* restore registers */ 36 lmg %r6, %r15, 48(%r15) 37 ldy %f0, 128(%r15) 38 ldy %f2, 136(%r15) 39 ldy %f4, 144(%r15) 40 ldy %f6, 152(%r15) 41 42 br %r14 /* restored by lmg */ 43 44 #ifdef __ELF__ 45 .section .note.GNU-stack,"",%progbits 46 #endif