summaryrefslogtreecommitdiff
path: root/arch/csky/kernel/ftrace.c
diff options
context:
space:
mode:
authorGuo Ren <guoren@linux.alibaba.com>2020-02-18 20:27:39 +0800
committerGuo Ren <guoren@linux.alibaba.com>2020-03-08 20:55:14 +0800
commit89a3927a775c0a7212e2e3c4e2d42cd48895bee0 (patch)
tree18dc3f0f5c95f004f7613882a511eb7e19b32ba6 /arch/csky/kernel/ftrace.c
parent9866d141a0977ace974400bf1f793dfc163409ce (diff)
downloadlinux-sh-89a3927a775c0a7212e2e3c4e2d42cd48895bee0.tar.gz
csky: Implement ftrace with regs
This patch implements FTRACE_WITH_REGS for csky, which allows a traced function's arguments (and some other registers) to be captured into a struct pt_regs, allowing these to be inspected and/or modified. Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Diffstat (limited to 'arch/csky/kernel/ftrace.c')
-rw-r--r--arch/csky/kernel/ftrace.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/csky/kernel/ftrace.c b/arch/csky/kernel/ftrace.c
index 44f4880179b7..b4502cd2eabe 100644
--- a/arch/csky/kernel/ftrace.c
+++ b/arch/csky/kernel/ftrace.c
@@ -126,6 +126,9 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
{
int ret = ftrace_modify_code((unsigned long)&ftrace_call,
(unsigned long)func, true, true);
+ if (!ret)
+ ret = ftrace_modify_code((unsigned long)&ftrace_regs_call,
+ (unsigned long)func, true, true);
return ret;
}
@@ -135,6 +138,14 @@ int __init ftrace_dyn_arch_init(void)
}
#endif /* CONFIG_DYNAMIC_FTRACE */
+#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
+int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr,
+ unsigned long addr)
+{
+ return ftrace_modify_code(rec->ip, addr, true, true);
+}
+#endif
+
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
unsigned long frame_pointer)