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 .hidden __xray_FunctionEntry
14 @ It preserves all registers except r0, r12(ip), r14(lr) and r15(pc)
15 @ Assume that "q" part of the floating-point registers is not used
16 @ for passing parameters to C/C++ functions.
17 .type __xray_FunctionEntry, %function
18 @ In C++ it is void extern "C" __xray_FunctionEntry(uint32_t FuncId) with
19 @ FuncId passed in r0 register.
22 @ Save floating-point parameters of the instrumented function
24 MOVW r1, #:lower16:_ZN6__xray19XRayPatchedFunctionE - (. + 16)
25 MOVT r1, #:upper16:_ZN6__xray19XRayPatchedFunctionE - (. + 12)
27 @ Handler address is nullptr if handler is not set
29 BEQ FunctionEntry_restore
30 @ Function ID is already in r0 (the first parameter).
31 @ r1=0 means that we are tracing an entry event
33 @ Call the handler with 2 parameters in r0 and r1
35 FunctionEntry_restore:
36 @ Restore floating-point parameters of the instrumented function
40 @ Word-aligned function entry point
42 @ Let C/C++ see the symbol
43 .global __xray_FunctionExit
44 .hidden __xray_FunctionExit
45 @ Assume that d1-d7 are not used for the return value.
46 @ Assume that "q" part of the floating-point registers is not used for the
47 @ return value in C/C++.
48 .type __xray_FunctionExit, %function
49 @ In C++ it is extern "C" void __xray_FunctionExit(uint32_t FuncId) with
50 @ FuncId passed in r0 register.
53 @ Save the floating-point return value of the instrumented function
55 @ Load the handler address
56 MOVW r1, #:lower16:_ZN6__xray19XRayPatchedFunctionE - (. + 16)
57 MOVT r1, #:upper16:_ZN6__xray19XRayPatchedFunctionE - (. + 12)
59 @ Handler address is nullptr if handler is not set
61 BEQ FunctionExit_restore
62 @ Function ID is already in r0 (the first parameter).
63 @ 1 means that we are tracing an exit event
65 @ Call the handler with 2 parameters in r0 and r1
68 @ Restore the floating-point return value of the instrumented function
72 @ Word-aligned function entry point
74 @ Let C/C++ see the symbol
75 .global __xray_FunctionTailExit
76 .hidden __xray_FunctionTailExit
77 @ It preserves all registers except r0, r12(ip), r14(lr) and r15(pc)
78 @ Assume that "q" part of the floating-point registers is not used
79 @ for passing parameters to C/C++ functions.
80 .type __xray_FunctionTailExit, %function
81 @ In C++ it is void extern "C" __xray_FunctionTailExit(uint32_t FuncId)
82 @ with FuncId passed in r0 register.
83 __xray_FunctionTailExit:
85 @ Save floating-point parameters of the instrumented function
87 MOVW r1, #:lower16:_ZN6__xray19XRayPatchedFunctionE - (. + 16)
88 MOVT r1, #:upper16:_ZN6__xray19XRayPatchedFunctionE - (. + 12)
90 @ Handler address is nullptr if handler is not set
92 BEQ FunctionTailExit_restore
93 @ Function ID is already in r0 (the first parameter).
94 @ r1=2 means that we are tracing a tail exit event
95 @ But before the logging part of XRay is ready, we pretend that here a
96 @ normal function exit happens, so we give the handler code 1
98 @ Call the handler with 2 parameters in r0 and r1
100 FunctionTailExit_restore:
101 @ Restore floating-point parameters of the instrumented function
105 NO_EXEC_STACK_DIRECTIVE