entry-ftrace.S (6f84981772535e670e4e2df051a672af229b6694) entry-ftrace.S (baaf553d3bc330697c68a00f96cf11f4edfeac7e)
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * arch/arm64/kernel/entry-ftrace.S
4 *
5 * Copyright (C) 2013 Linaro Limited
6 * Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
7 */
8

--- 51 unchanged lines hidden (view full) ---

60 /* Create a frame record for the callsite above the ftrace regs */
61 stp x29, x9, [sp, #FREGS_SIZE + 16]
62 add x29, sp, #FREGS_SIZE + 16
63
64 /* Create our frame record above the ftrace regs */
65 stp x29, x30, [sp, #FREGS_SIZE]
66 add x29, sp, #FREGS_SIZE
67
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * arch/arm64/kernel/entry-ftrace.S
4 *
5 * Copyright (C) 2013 Linaro Limited
6 * Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
7 */
8

--- 51 unchanged lines hidden (view full) ---

60 /* Create a frame record for the callsite above the ftrace regs */
61 stp x29, x9, [sp, #FREGS_SIZE + 16]
62 add x29, sp, #FREGS_SIZE + 16
63
64 /* Create our frame record above the ftrace regs */
65 stp x29, x30, [sp, #FREGS_SIZE]
66 add x29, sp, #FREGS_SIZE
67
68 sub x0, x30, #AARCH64_INSN_SIZE // ip (callsite's BL insn)
69 mov x1, x9 // parent_ip (callsite's LR)
70 ldr_l x2, function_trace_op // op
71 mov x3, sp // regs
68 /* Prepare arguments for the the tracer func */
69 sub x0, x30, #AARCH64_INSN_SIZE // ip (callsite's BL insn)
70 mov x1, x9 // parent_ip (callsite's LR)
71 mov x3, sp // regs
72
72
73#ifdef CONFIG_DYNAMIC_FTRACE_WITH_CALL_OPS
74 /*
75 * The literal pointer to the ops is at an 8-byte aligned boundary
76 * which is either 12 or 16 bytes before the BL instruction in the call
77 * site. See ftrace_call_adjust() for details.
78 *
79 * Therefore here the LR points at `literal + 16` or `literal + 20`,
80 * and we can find the address of the literal in either case by
81 * aligning to an 8-byte boundary and subtracting 16. We do the
82 * alignment first as this allows us to fold the subtraction into the
83 * LDR.
84 */
85 bic x2, x30, 0x7
86 ldr x2, [x2, #-16] // op
87
88 ldr x4, [x2, #FTRACE_OPS_FUNC] // op->func
89 blr x4 // op->func(ip, parent_ip, op, regs)
90
91#else
92 ldr_l x2, function_trace_op // op
93
73SYM_INNER_LABEL(ftrace_call, SYM_L_GLOBAL)
94SYM_INNER_LABEL(ftrace_call, SYM_L_GLOBAL)
74 bl ftrace_stub
95 bl ftrace_stub // func(ip, parent_ip, op, regs)
96#endif
75
76/*
77 * At the callsite x0-x8 and x19-x30 were live. Any C code will have preserved
78 * x19-x29 per the AAPCS, and we created frame records upon entry, so we need
79 * to restore x0-x8, x29, and x30.
80 */
81 /* Restore function arguments */
82 ldp x0, x1, [sp, #FREGS_X0]

--- 188 unchanged lines hidden ---
97
98/*
99 * At the callsite x0-x8 and x19-x30 were live. Any C code will have preserved
100 * x19-x29 per the AAPCS, and we created frame records upon entry, so we need
101 * to restore x0-x8, x29, and x30.
102 */
103 /* Restore function arguments */
104 ldp x0, x1, [sp, #FREGS_X0]

--- 188 unchanged lines hidden ---