Commit 0ef86097 authored by Mark Rutland's avatar Mark Rutland Committed by Will Deacon
Browse files

ftrace: rename ftrace_instruction_pointer_set() -> ftrace_regs_set_instruction_pointer()



In subsequent patches we'll add a sew of ftrace_regs_{get,set}_*()
helpers. In preparation, this patch renames
ftrace_instruction_pointer_set() to
ftrace_regs_set_instruction_pointer().

There should be no functional change as a result of this patch.

Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
Cc: Florent Revest <revest@chromium.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Reviewed-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
Reviewed-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
Link: https://lore.kernel.org/r/20221103170520.931305-3-mark.rutland@arm.com


Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent 9705bc70
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -37,7 +37,8 @@ static __always_inline struct pt_regs *arch_ftrace_get_regs(struct ftrace_regs *
	return fregs->regs.msr ? &fregs->regs : NULL;
}

static __always_inline void ftrace_instruction_pointer_set(struct ftrace_regs *fregs,
static __always_inline void
ftrace_regs_set_instruction_pointer(struct ftrace_regs *fregs,
				    unsigned long ip)
{
	regs_set_return_ip(&fregs->regs, ip);
+3 −2
Original line number Diff line number Diff line
@@ -54,7 +54,8 @@ static __always_inline struct pt_regs *arch_ftrace_get_regs(struct ftrace_regs *
	return NULL;
}

static __always_inline void ftrace_instruction_pointer_set(struct ftrace_regs *fregs,
static __always_inline void
ftrace_regs_set_instruction_pointer(struct ftrace_regs *fregs,
				    unsigned long ip)
{
	fregs->regs.psw.addr = ip;
+1 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ arch_ftrace_get_regs(struct ftrace_regs *fregs)
	return &fregs->regs;
}

#define ftrace_instruction_pointer_set(fregs, _ip)	\
#define ftrace_regs_set_instruction_pointer(fregs, _ip)	\
	do { (fregs)->regs.ip = (_ip); } while (0)

struct ftrace_ops;
+4 −5
Original line number Diff line number Diff line
@@ -111,12 +111,11 @@ struct ftrace_regs {
#define arch_ftrace_get_regs(fregs) (&(fregs)->regs)

/*
 * ftrace_instruction_pointer_set() is to be defined by the architecture
 * if to allow setting of the instruction pointer from the ftrace_regs
 * when HAVE_DYNAMIC_FTRACE_WITH_ARGS is set and it supports
 * live kernel patching.
 * ftrace_regs_set_instruction_pointer() is to be defined by the architecture
 * if to allow setting of the instruction pointer from the ftrace_regs when
 * HAVE_DYNAMIC_FTRACE_WITH_ARGS is set and it supports live kernel patching.
 */
#define ftrace_instruction_pointer_set(fregs, ip) do { } while (0)
#define ftrace_regs_set_instruction_pointer(fregs, ip) do { } while (0)
#endif /* CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS */

static __always_inline struct pt_regs *ftrace_get_regs(struct ftrace_regs *fregs)
+1 −1
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ static void notrace klp_ftrace_handler(unsigned long ip,
	if (func->nop)
		goto unlock;

	ftrace_instruction_pointer_set(fregs, (unsigned long)func->new_func);
	ftrace_regs_set_instruction_pointer(fregs, (unsigned long)func->new_func);

unlock:
	ftrace_test_recursion_unlock(bit);