167845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot// Copyright 2016 The Go Authors. All rights reserved. 267845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot// Use of this source code is governed by a BSD-style 367845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot// license that can be found in the LICENSE file. 467845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot 567845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot/* 667845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot * void crosscall_s390x(void (*fn)(void), void *g) 767845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot * 867845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot * Calling into the go tool chain, where all registers are caller save. 967845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot * Called from standard s390x C ABI, where r6-r13, r15, and f8-f15 are 1067845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot * callee-save, so they must be saved explicitly. 1167845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot */ 1267845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot.globl crosscall_s390x 1367845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robotcrosscall_s390x: 1467845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot /* save r6-r15 in the register save area of the calling function */ 1567845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot stmg %r6, %r15, 48(%r15) 1667845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot 1767845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot /* allocate 64 bytes of stack space to save f8-f15 */ 1867845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot lay %r15, -64(%r15) 1967845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot 2067845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot /* save callee-saved floating point registers */ 2167845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot std %f8, 0(%r15) 2267845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot std %f9, 8(%r15) 2367845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot std %f10, 16(%r15) 2467845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot std %f11, 24(%r15) 2567845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot std %f12, 32(%r15) 2667845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot std %f13, 40(%r15) 2767845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot std %f14, 48(%r15) 2867845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot std %f15, 56(%r15) 2967845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot 3067845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot /* restore g pointer */ 3167845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot lgr %r13, %r3 3267845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot 3367845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot /* call fn */ 3467845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot basr %r14, %r2 3567845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot 3667845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot /* restore floating point registers */ 3767845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot ld %f8, 0(%r15) 3867845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot ld %f9, 8(%r15) 3967845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot ld %f10, 16(%r15) 4067845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot ld %f11, 24(%r15) 4167845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot ld %f12, 32(%r15) 4267845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot ld %f13, 40(%r15) 4367845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot ld %f14, 48(%r15) 4467845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot ld %f15, 56(%r15) 4567845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot 4667845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot /* de-allocate stack frame */ 4767845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot la %r15, 64(%r15) 4867845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot 4967845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot /* restore general purpose registers */ 5067845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot lmg %r6, %r15, 48(%r15) 5167845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot 5267845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot br %r14 /* restored by lmg */ 5367845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot 5467845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot#ifdef __ELF__ 5567845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot.section .note.GNU-stack,"",%progbits 5667845c40aa5be5001fb20ef6f6b8d52e3fe6bb1android-build-team Robot#endif 57