brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · 746d612 Raw
97 lines · plain
1//===-- xray_trampoline_riscv_common.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 trampolines code shared between riscv32 and riscv64.12//13//===----------------------------------------------------------------------===//14 15#include "../builtins/assembly.h"16 17	.text18	.p2align 219	.global ASM_SYMBOL(__xray_FunctionEntry)20	ASM_TYPE_FUNCTION(__xray_FunctionEntry)21ASM_SYMBOL(__xray_FunctionEntry):22	CFI_STARTPROC23        SAVE_ARG_REGISTERS24 25	// Load the handler function pointer into a226	la	a2, ASM_SYMBOL(_ZN6__xray19XRayPatchedFunctionE)27        LOAD_XLEN   a2, 0(a2)28 29	// Handler address will be null if it is not set30	beq	a2, x0, 1f31 32	// If we reach here, we are tracing an event33	// a0 already contains function id34	// a1 = 0 means we are tracing an entry event35	li	a1, 036	jalr	a237 381:39        RESTORE_ARG_REGISTERS40	jr	ra41	ASM_SIZE(__xray_FunctionEntry)42	CFI_ENDPROC43 44	.text45	.p2align 246	.global ASM_SYMBOL(__xray_FunctionExit)47	ASM_TYPE_FUNCTION(__xray_FunctionExit)48ASM_SYMBOL(__xray_FunctionExit):49	CFI_STARTPROC50	SAVE_RET_REGISTERS51 52	// Load the handler function pointer into a253	la	a2, ASM_SYMBOL(_ZN6__xray19XRayPatchedFunctionE)54        LOAD_XLEN   a2, 0(a2)55 56	// Handler address will be null if it is not set57	beq	a2, x0, 1f58 59	// If we reach here, we are tracing an event60	// a0 already contains function id61	// a1 = 1 means we are tracing an exit event62	li	a1, 163	jalr	a264 651:66	RESTORE_RET_REGISTERS67        jr	ra68	ASM_SIZE(__xray_FunctionExit)69	CFI_ENDPROC70 71	.text72	.p2align 273	.global ASM_SYMBOL(__xray_FunctionTailExit)74	ASM_TYPE_FUNCTION(__xray_FunctionTailExit)75ASM_SYMBOL(__xray_FunctionTailExit):76	CFI_STARTPROC77        SAVE_ARG_REGISTERS78 79	// Load the handler function pointer into a280	la	a2, ASM_SYMBOL(_ZN6__xray19XRayPatchedFunctionE)81        LOAD_XLEN   a2, 0(a2)82 83	// Handler address will be null if it is not set84	beq	a2, x0, 1f85 86	// If we reach here, we are tracing an event87	// a0 already contains function id88	// a1 = 2 means we are tracing a tail exit event89	li	a1, 290	jalr	a291 921:93        RESTORE_ARG_REGISTERS94	jr	ra95	ASM_SIZE(__xray_FunctionTailExit)96	CFI_ENDPROC97