1 //===-- xray_trampoline_s390x.s ---------------------------------*- ASM -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file is a part of XRay, a dynamic runtime instrumentation system.
11 // This implements the s390x-specific assembler for the trampolines.
12 // 2 versions of the functions are provided: one which does not store the
13 // vector registers, and one which does store them. The compiler decides
14 // which to call based on the availability of the vector extension.
16 //===----------------------------------------------------------------------===//
20 // Minimal stack frame size
23 // Minimal stack frame size (160) plus space for 8 vector registers a 16 bytes.
24 #define STACKSZ_VEC 288
26 //===----------------------------------------------------------------------===//
28 .globl __xray_FunctionEntry
30 .type __xray_FunctionEntry,@function
32 # The registers r2-15 of the instrumented function are already saved in the
33 # stack frame. On entry, r2 contains the function id, and %r14 the address
34 # of the first instruction of the instrumented function.
35 # Register r14 will be stored in the slot reserved for compiler use.
43 lgrl %r1, _ZN6__xray19XRayPatchedFunctionE@GOT
47 # Set r3 to XRayEntryType::ENTRY = 0.
48 # The FuncId is still stored in r2.
53 ld %f6, STACKSZ+152(%r15)
54 ld %f4, STACKSZ+144(%r15)
55 ld %f2, STACKSZ+136(%r15)
56 ld %f0, STACKSZ+128(%r15)
57 lmg %r1, %r15, STACKSZ+8(%r15)
60 .size __xray_FunctionEntry, .Lfunc_end0-__xray_FunctionEntry
62 //===----------------------------------------------------------------------===//
64 .globl __xray_FunctionEntryVec
66 .type __xray_FunctionEntryVec,@function
67 __xray_FunctionEntryVec:
68 # The registers r2-15 of the instrumented function are already saved in the
69 # stack frame. On entry, r2 contains the function id, and %r14 the address
70 # of the first instruction of the instrumented function.
71 # Register r14 will be stored in the slot reserved for compiler use.
77 aghi %r15, -STACKSZ_VEC
78 vstm %v24, %v31, 160(%r15)
80 lgrl %r1, _ZN6__xray19XRayPatchedFunctionE@GOT
84 # Set r3 to XRayEntryType::ENTRY = 0.
85 # The FuncId is still stored in r2.
90 vlm %v24, %v31, 160(%r15)
91 ld %f6, STACKSZ_VEC+152(%r15)
92 ld %f4, STACKSZ_VEC+144(%r15)
93 ld %f2, STACKSZ_VEC+136(%r15)
94 ld %f0, STACKSZ_VEC+128(%r15)
95 lmg %r1, %r15, STACKSZ_VEC+8(%r15)
98 .size __xray_FunctionEntryVec, .Lfunc_end1-__xray_FunctionEntryVec
100 //===----------------------------------------------------------------------===//
102 .globl __xray_FunctionExit
104 .type __xray_FunctionExit,@function
106 # The registers r2-15 of the instrumented function are already saved in the
107 # stack frame. On entry, the register r2 contains the function id.
108 # At the end, the function jumps to the address saved in the slot for r14,
109 # which contains the return address into the caller of the instrumented
117 lgrl %r1, _ZN6__xray19XRayPatchedFunctionE@GOT
121 # Set r3 to XRayEntryType::EXIT = 1.
122 # The FuncId is still stored in r2.
127 ld %f6, STACKSZ+152(%r15)
128 ld %f4, STACKSZ+144(%r15)
129 ld %f2, STACKSZ+136(%r15)
130 ld %f0, STACKSZ+128(%r15)
131 lmg %r2, %r15, STACKSZ+16(%r15)
134 .size __xray_FunctionExit, .Lfunc_end2-__xray_FunctionExit
136 //===----------------------------------------------------------------------===//
138 .globl __xray_FunctionExitVec
140 .type __xray_FunctionExitVec,@function
141 __xray_FunctionExitVec:
142 # The registers r2-15 of the instrumented function are already saved in the
143 # stack frame. On entry, the register r2 contains the function id.
144 # At the end, the function jumps to the address saved in the slot for r14,
145 # which contains the return address into the caller of the instrumented
151 aghi %r15, -STACKSZ_VEC
152 vstm %v24, %v31, 160(%r15)
154 lgrl %r1, _ZN6__xray19XRayPatchedFunctionE@GOT
158 # Set r3 to XRayEntryType::EXIT = 1.
159 # The FuncId is still stored in r2.
164 vlm %v24, %v31, 160(%r15)
165 ld %f6, STACKSZ_VEC+152(%r15)
166 ld %f4, STACKSZ_VEC+144(%r15)
167 ld %f2, STACKSZ_VEC+136(%r15)
168 ld %f0, STACKSZ_VEC+128(%r15)
169 lmg %r2, %r15, STACKSZ_VEC+16(%r15)
172 .size __xray_FunctionExit, .Lfunc_end3-__xray_FunctionExit
174 //===----------------------------------------------------------------------===//
176 .section ".note.GNU-stack","",@progbits