Commit d95bf254 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/ftrace: Prepare PPC32's ftrace_caller() for CONFIG_DYNAMIC_FTRACE_WITH_ARGS

In order to implement CONFIG_DYNAMIC_FTRACE_WITH_ARGS, change
ftrace_caller() stack layout to match struct pt_regs.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/da9734eba504998fb914aca12131c9f6bf6120a8.1640017960.git.christophe.leroy@csgroup.eu
parent 7bdb478c
......@@ -10,44 +10,7 @@
#define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
#ifdef __ASSEMBLY__
/* Based off of objdump output from glibc */
#define MCOUNT_SAVE_FRAME \
stwu r1,-48(r1); \
stw r3, 12(r1); \
stw r4, 16(r1); \
stw r5, 20(r1); \
stw r6, 24(r1); \
mflr r3; \
lwz r4, 52(r1); \
mfcr r5; \
stw r7, 28(r1); \
stw r8, 32(r1); \
stw r9, 36(r1); \
stw r10,40(r1); \
stw r3, 44(r1); \
stw r5, 8(r1)
#define MCOUNT_RESTORE_FRAME \
lwz r6, 8(r1); \
lwz r0, 44(r1); \
lwz r3, 12(r1); \
mtctr r0; \
lwz r4, 16(r1); \
mtcr r6; \
lwz r5, 20(r1); \
lwz r6, 24(r1); \
lwz r0, 52(r1); \
lwz r7, 28(r1); \
lwz r8, 32(r1); \
mtlr r0; \
lwz r9, 36(r1); \
lwz r10,40(r1); \
addi r1, r1, 48
#else /* !__ASSEMBLY__ */
#ifndef __ASSEMBLY__
extern void _mcount(void);
static inline unsigned long ftrace_call_adjust(unsigned long addr)
......
......@@ -27,17 +27,38 @@ _GLOBAL(_mcount)
EXPORT_SYMBOL(_mcount)
_GLOBAL(ftrace_caller)
MCOUNT_SAVE_FRAME
/* r3 ends up with link register */
stwu r1, -INT_FRAME_SIZE(r1)
SAVE_GPRS(3, 10, r1)
addi r8, r1, INT_FRAME_SIZE
stw r8, GPR1(r1)
mflr r3
stw r3, _NIP(r1)
subi r3, r3, MCOUNT_INSN_SIZE
stw r0, _LINK(r1)
mr r4, r0
lis r5,function_trace_op@ha
lwz r5,function_trace_op@l(r5)
li r6, 0
addi r6, r1, STACK_FRAME_OVERHEAD
.globl ftrace_call
ftrace_call:
bl ftrace_stub
nop
MCOUNT_RESTORE_FRAME
lwz r3, _NIP(r1)
mtctr r3
REST_GPRS(3, 10, r1)
lwz r0, _LINK(r1)
mtlr r0
addi r1, r1, INT_FRAME_SIZE
ftrace_caller_common:
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
.globl ftrace_graph_call
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment