Path: blob/main/contrib/llvm-project/compiler-rt/lib/xray/xray_trampoline_arm.S
35264 views
#include "../builtins/assembly.h"12.syntax unified3.arch armv6t24.fpu vfpv25.code 326.global _ZN6__xray19XRayPatchedFunctionE78@ Word-aligned function entry point9.p2align 210@ Let C/C++ see the symbol11.global __xray_FunctionEntry12.hidden __xray_FunctionEntry13@ It preserves all registers except r0, r12(ip), r14(lr) and r15(pc)14@ Assume that "q" part of the floating-point registers is not used15@ for passing parameters to C/C++ functions.16.type __xray_FunctionEntry, %function17@ In C++ it is void extern "C" __xray_FunctionEntry(uint32_t FuncId) with18@ FuncId passed in r0 register.19__xray_FunctionEntry:20PUSH {r1-r3,lr}21@ Save floating-point parameters of the instrumented function22VPUSH {d0-d7}23MOVW r1, #:lower16:_ZN6__xray19XRayPatchedFunctionE - (. + 16)24MOVT r1, #:upper16:_ZN6__xray19XRayPatchedFunctionE - (. + 12)25LDR r2, [pc, r1]26@ Handler address is nullptr if handler is not set27CMP r2, #028BEQ FunctionEntry_restore29@ Function ID is already in r0 (the first parameter).30@ r1=0 means that we are tracing an entry event31MOV r1, #032@ Call the handler with 2 parameters in r0 and r133BLX r234FunctionEntry_restore:35@ Restore floating-point parameters of the instrumented function36VPOP {d0-d7}37POP {r1-r3,pc}3839@ Word-aligned function entry point40.p2align 241@ Let C/C++ see the symbol42.global __xray_FunctionExit43.hidden __xray_FunctionExit44@ Assume that d1-d7 are not used for the return value.45@ Assume that "q" part of the floating-point registers is not used for the46@ return value in C/C++.47.type __xray_FunctionExit, %function48@ In C++ it is extern "C" void __xray_FunctionExit(uint32_t FuncId) with49@ FuncId passed in r0 register.50__xray_FunctionExit:51PUSH {r1-r3,lr}52@ Save the floating-point return value of the instrumented function53VPUSH {d0}54@ Load the handler address55MOVW r1, #:lower16:_ZN6__xray19XRayPatchedFunctionE - (. + 16)56MOVT r1, #:upper16:_ZN6__xray19XRayPatchedFunctionE - (. + 12)57LDR r2, [pc, r1]58@ Handler address is nullptr if handler is not set59CMP r2, #060BEQ FunctionExit_restore61@ Function ID is already in r0 (the first parameter).62@ 1 means that we are tracing an exit event63MOV r1, #164@ Call the handler with 2 parameters in r0 and r165BLX r266FunctionExit_restore:67@ Restore the floating-point return value of the instrumented function68VPOP {d0}69POP {r1-r3,pc}7071@ Word-aligned function entry point72.p2align 273@ Let C/C++ see the symbol74.global __xray_FunctionTailExit75.hidden __xray_FunctionTailExit76@ It preserves all registers except r0, r12(ip), r14(lr) and r15(pc)77@ Assume that "q" part of the floating-point registers is not used78@ for passing parameters to C/C++ functions.79.type __xray_FunctionTailExit, %function80@ In C++ it is void extern "C" __xray_FunctionTailExit(uint32_t FuncId)81@ with FuncId passed in r0 register.82__xray_FunctionTailExit:83PUSH {r1-r3,lr}84@ Save floating-point parameters of the instrumented function85VPUSH {d0-d7}86MOVW r1, #:lower16:_ZN6__xray19XRayPatchedFunctionE - (. + 16)87MOVT r1, #:upper16:_ZN6__xray19XRayPatchedFunctionE - (. + 12)88LDR r2, [pc, r1]89@ Handler address is nullptr if handler is not set90CMP r2, #091BEQ FunctionTailExit_restore92@ Function ID is already in r0 (the first parameter).93@ r1=2 means that we are tracing a tail exit event94@ But before the logging part of XRay is ready, we pretend that here a95@ normal function exit happens, so we give the handler code 196MOV r1, #197@ Call the handler with 2 parameters in r0 and r198BLX r299FunctionTailExit_restore:100@ Restore floating-point parameters of the instrumented function101VPOP {d0-d7}102POP {r1-r3,pc}103104NO_EXEC_STACK_DIRECTIVE105106107