summaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/ftrace.h
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2019-11-08 13:11:39 -0500
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2019-11-13 09:36:49 -0500
commit562955fe6a558b9ef98ad87c470314946338cb2f (patch)
treecb76aa51c8a29ef696210e9145ff45772094ed98 /arch/x86/include/asm/ftrace.h
parented9dafebce52206382de96bd5bbdff22335930f6 (diff)
downloadlinux-562955fe6a558b9ef98ad87c470314946338cb2f.tar.gz
linux-562955fe6a558b9ef98ad87c470314946338cb2f.tar.bz2
linux-562955fe6a558b9ef98ad87c470314946338cb2f.zip
ftrace/x86: Add register_ftrace_direct() for custom trampolines
Enable x86 to allow for register_ftrace_direct(), where a custom trampoline may be called directly from an ftrace mcount/fentry location. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'arch/x86/include/asm/ftrace.h')
-rw-r--r--arch/x86/include/asm/ftrace.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h
index c38a66661576..c2a7458f912c 100644
--- a/arch/x86/include/asm/ftrace.h
+++ b/arch/x86/include/asm/ftrace.h
@@ -28,6 +28,19 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)
return addr;
}
+/*
+ * When a ftrace registered caller is tracing a function that is
+ * also set by a register_ftrace_direct() call, it needs to be
+ * differentiated in the ftrace_caller trampoline. To do this, we
+ * place the direct caller in the ORIG_AX part of pt_regs. This
+ * tells the ftrace_caller that there's a direct caller.
+ */
+static inline void arch_ftrace_set_direct_caller(struct pt_regs *regs, unsigned long addr)
+{
+ /* Emulate a call */
+ regs->orig_ax = addr;
+}
+
#ifdef CONFIG_DYNAMIC_FTRACE
struct dyn_arch_ftrace {