1 #include "../builtins/assembly.h"
7 .global _ZN6__xray19XRayPatchedFunctionE
9 @ Word-aligned function entry point
11 @ Let C/C++ see the symbol
12 .global __xray_FunctionEntry
13 @ 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 used
15 @ for passing parameters to C/C++ functions.
16 .type __xray_FunctionEntry, %function
17 @ In C++ it is void extern "C" __xray_FunctionEntry(uint32_t FuncId) with
18 @ FuncId passed in r0 register.
21 @ Save floating-point parameters of the instrumented function
23 MOVW r1,#:lower16:_ZN6__xray19XRayPatchedFunctionE
24 MOVT r1,#:upper16:_ZN6__xray19XRayPatchedFunctionE
26 @ Handler address is nullptr if handler is not set
28 BEQ FunctionEntry_restore
29 @ Function ID is already in r0 (the first parameter).
30 @ r1=0 means that we are tracing an entry event
32 @ Call the handler with 2 parameters in r0 and r1
34 FunctionEntry_restore:
35 @ Restore floating-point parameters of the instrumented function
39 @ Word-aligned function entry point
41 @ Let C/C++ see the symbol
42 .global __xray_FunctionExit
43 @ Assume that d1-d7 are not used for the return value.
44 @ Assume that "q" part of the floating-point registers is not used for the
45 @ return value in C/C++.
46 .type __xray_FunctionExit, %function
47 @ In C++ it is extern "C" void __xray_FunctionExit(uint32_t FuncId) with
48 @ FuncId passed in r0 register.
51 @ Save the floating-point return value of the instrumented function
53 @ Load the handler address
54 MOVW r1,#:lower16:_ZN6__xray19XRayPatchedFunctionE
55 MOVT r1,#:upper16:_ZN6__xray19XRayPatchedFunctionE
57 @ Handler address is nullptr if handler is not set
59 BEQ FunctionExit_restore
60 @ Function ID is already in r0 (the first parameter).
61 @ 1 means that we are tracing an exit event
63 @ Call the handler with 2 parameters in r0 and r1
66 @ Restore the floating-point return value of the instrumented function
70 @ Word-aligned function entry point
72 @ Let C/C++ see the symbol
73 .global __xray_FunctionTailExit
74 @ It preserves all registers except r0, r12(ip), r14(lr) and r15(pc)
75 @ Assume that "q" part of the floating-point registers is not used
76 @ for passing parameters to C/C++ functions.
77 .type __xray_FunctionTailExit, %function
78 @ In C++ it is void extern "C" __xray_FunctionTailExit(uint32_t FuncId)
79 @ with FuncId passed in r0 register.
80 __xray_FunctionTailExit:
82 @ Save floating-point parameters of the instrumented function
84 MOVW r1,#:lower16:_ZN6__xray19XRayPatchedFunctionE
85 MOVT r1,#:upper16:_ZN6__xray19XRayPatchedFunctionE
87 @ Handler address is nullptr if handler is not set
89 BEQ FunctionTailExit_restore
90 @ Function ID is already in r0 (the first parameter).
91 @ r1=2 means that we are tracing a tail exit event
92 @ But before the logging part of XRay is ready, we pretend that here a
93 @ normal function exit happens, so we give the handler code 1
95 @ Call the handler with 2 parameters in r0 and r1
97 FunctionTailExit_restore:
98 @ Restore floating-point parameters of the instrumented function
102 NO_EXEC_STACK_DIRECTIVE