brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.9 KiB · 4073943 Raw
177 lines · plain
1//===-- xray_trampoline_s390x.s ---------------------------------*- ASM -*-===//2//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-exception6//7//===----------------------------------------------------------------------===//8//9// This file is a part of XRay, a dynamic runtime instrumentation system.10//11// This implements the s390x-specific assembler for the trampolines.12// 2 versions of the functions are provided: one which does not store the13// vector registers, and one which does store them. The compiler decides14// which to call based on the availability of the vector extension.15//16//===----------------------------------------------------------------------===//17 18    .text19 20// Minimal stack frame size21#define STACKSZ  16022 23// Minimal stack frame size (160) plus space for 8 vector registers a 16 bytes.24#define STACKSZ_VEC  28825 26//===----------------------------------------------------------------------===//27 28    .globl  __xray_FunctionEntry29    .p2align    430    .type   __xray_FunctionEntry,@function31__xray_FunctionEntry:32    # The registers r2-15 of the instrumented function are already saved in the33    # stack frame. On entry, r2 contains the function id, and %r14 the address34    # of the first instruction of the instrumented function.35    # Register r14 will be stored in the slot reserved for compiler use.36    stg     %r14, 8(%r15)37    std     %f0, 128(%r15)38    std     %f2, 136(%r15)39    std     %f4, 144(%r15)40    std     %f6, 152(%r15)41    aghi    %r15, -STACKSZ42 43    lgrl    %r1, _ZN6__xray19XRayPatchedFunctionE@GOT44    ltg     %r1, 0(%r1)45    je      .Lrestore046 47    # Set r3 to XRayEntryType::ENTRY = 0.48    # The FuncId is still stored in r2.49    lghi    %r3, 050    basr    %r14, %r151 52.Lrestore0: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)58    br      %r159.Lfunc_end0:60    .size    __xray_FunctionEntry, .Lfunc_end0-__xray_FunctionEntry61 62//===----------------------------------------------------------------------===//63 64    .globl  __xray_FunctionEntryVec65    .p2align    466    .type   __xray_FunctionEntryVec,@function67__xray_FunctionEntryVec:68    # The registers r2-15 of the instrumented function are already saved in the69    # stack frame. On entry, r2 contains the function id, and %r14 the address70    # of the first instruction of the instrumented function.71    # Register r14 will be stored in the slot reserved for compiler use.72    stg     %r14, 8(%r15)73    std     %f0, 128(%r15)74    std     %f2, 136(%r15)75    std     %f4, 144(%r15)76    std     %f6, 152(%r15)77    aghi    %r15, -STACKSZ_VEC78    vstm    %v24, %v31, 160(%r15)79 80    lgrl    %r1, _ZN6__xray19XRayPatchedFunctionE@GOT81    ltg     %r1, 0(%r1)82    je      .Lrestore183 84    # Set r3 to XRayEntryType::ENTRY = 0.85    # The FuncId is still stored in r2.86    lghi    %r3, 087    basr    %r14, %r188 89.Lrestore1: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)96    br      %r197.Lfunc_end1:98    .size    __xray_FunctionEntryVec, .Lfunc_end1-__xray_FunctionEntryVec99 100//===----------------------------------------------------------------------===//101 102    .globl  __xray_FunctionExit103    .p2align    4104    .type   __xray_FunctionExit,@function105__xray_FunctionExit:106    # The registers r2-15 of the instrumented function are already saved in the107    # 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 instrumented110    # function.111    std     %f0, 128(%r15)112    std     %f2, 136(%r15)113    std     %f4, 144(%r15)114    std     %f6, 152(%r15)115    aghi    %r15, -STACKSZ116 117    lgrl    %r1, _ZN6__xray19XRayPatchedFunctionE@GOT118    ltg     %r1, 0(%r1)119    je      .Lrestore2120 121    # Set r3 to XRayEntryType::EXIT = 1.122    # The FuncId is still stored in r2.123    lghi    %r3, 1124    basr    %r14, %r1125 126.Lrestore2: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)132    br      %r14133.Lfunc_end2:134    .size    __xray_FunctionExit, .Lfunc_end2-__xray_FunctionExit135 136//===----------------------------------------------------------------------===//137 138    .globl  __xray_FunctionExitVec139    .p2align    4140    .type   __xray_FunctionExitVec,@function141__xray_FunctionExitVec:142    # The registers r2-15 of the instrumented function are already saved in the143    # 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 instrumented146    # function.147    std     %f0, 128(%r15)148    std     %f2, 136(%r15)149    std     %f4, 144(%r15)150    std     %f6, 152(%r15)151    aghi    %r15, -STACKSZ_VEC152    vstm    %v24, %v31, 160(%r15)153 154    lgrl    %r1, _ZN6__xray19XRayPatchedFunctionE@GOT155    ltg     %r1, 0(%r1)156    je      .Lrestore3157 158    # Set r3 to XRayEntryType::EXIT = 1.159    # The FuncId is still stored in r2.160    lghi    %r3, 1161    basr    %r14, %r1162 163.Lrestore3: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)170    br      %r14171.Lfunc_end3:172    .size    __xray_FunctionExit, .Lfunc_end3-__xray_FunctionExit173 174//===----------------------------------------------------------------------===//175 176    .section    ".note.GNU-stack","",@progbits177