Path: blob/main/contrib/llvm-project/compiler-rt/lib/xray/xray_trampoline_hexagon.S
35264 views
//===-- xray_trampoline_hexagon.s -------------------------------*- ASM -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file is a part of XRay, a dynamic runtime instrumentation system.9//10// This implements the hexagon-specific assembler for the trampolines.11//12//===----------------------------------------------------------------------===//1314#include "../builtins/assembly.h"15#include "../sanitizer_common/sanitizer_asm.h"1617.macro SAVE_REGISTERS18memw(sp+#0)=r019memw(sp+#4)=r120memw(sp+#8)=r221memw(sp+#12)=r322memw(sp+#16)=r423.endm24.macro RESTORE_REGISTERS25r0=memw(sp+#0)26r1=memw(sp+#4)27r2=memw(sp+#8)28r3=memw(sp+#12)29r4=memw(sp+#16)30.endm3132.macro CALL_PATCHED_FUNC entry_type33// if (xray::XRayPatchedFunctionE != NULL)34// xray::XRayPatchedFunctionE(FuncType);3536r8 = #ASM_SYMBOL(_ZN6__xray19XRayPatchedFunctionE)3738// The patched sled puts the function type39// into r6. Move it into r0 to pass it to40// the patched function.41{ r0 = r642r1 = \entry_type43p0 = !cmp.eq(r8, #0)44if (p0) callr r8 }45.endm4647.text48.globl ASM_SYMBOL(__xray_FunctionEntry)49ASM_HIDDEN(__xray_FunctionEntry)50ASM_TYPE_FUNCTION(__xray_FunctionEntry)51# LLVM-MCA-BEGIN __xray_FunctionEntry52ASM_SYMBOL(__xray_FunctionEntry):53CFI_STARTPROC54SAVE_REGISTERS5556CALL_PATCHED_FUNC #0 // XRayEntryType::ENTRY57.Ltmp0:58RESTORE_REGISTERS59// return60# LLVM-MCA-END61ASM_SIZE(__xray_FunctionEntry)62CFI_ENDPROC636465.globl ASM_SYMBOL(__xray_FunctionExit)66ASM_HIDDEN(__xray_FunctionExit)67ASM_TYPE_FUNCTION(__xray_FunctionExit)68# LLVM-MCA-BEGIN __xray_FunctionExit69ASM_SYMBOL(__xray_FunctionExit):70CFI_STARTPROC71SAVE_REGISTERS7273CALL_PATCHED_FUNC #1 // XRayEntryType::EXIT74.Ltmp1:75RESTORE_REGISTERS76// return77jumpr r3178# LLVM-MCA-END79ASM_SIZE(__xray_FunctionExit)80CFI_ENDPROC818283.globl ASM_SYMBOL(__xray_FunctionTailExit)84ASM_HIDDEN(__xray_FunctionTailExit)85ASM_TYPE_FUNCTION(__xray_FunctionTailExit)86# LLVM-MCA-BEGIN __xray_FunctionTailExit87ASM_SYMBOL(__xray_FunctionTailExit):88CFI_STARTPROC89SAVE_REGISTERS9091CALL_PATCHED_FUNC #2 // XRayEntryType::TAIL92.Ltmp2:93RESTORE_REGISTERS94// return95jumpr r3196# LLVM-MCA-END97ASM_SIZE(__xray_FunctionTailExit)98CFI_ENDPROC99100101