powerpc/ptrace: Move set_return_regs_changed() before regs_set_return_{msr/ip}

regs_set_return_msr() and regs_set_return_ip() have a copy
of the code of set_return_regs_changed().

Move up set_return_regs_changed() so it can be reused by
regs_set_return_{msr/ip}

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/49f4fb051a3e1cb69f7305d5b6768aec14727c32.1624619582.git.christophe.leroy@csgroup.eu
This commit is contained in:
Christophe Leroy 2021-06-25 11:13:16 +00:00 committed by Michael Ellerman
parent 7c6986ade6
commit 5f0f95f1e1
1 changed files with 8 additions and 8 deletions

View File

@ -135,6 +135,14 @@ extern unsigned long profile_pc(struct pt_regs *regs);
long do_syscall_trace_enter(struct pt_regs *regs); long do_syscall_trace_enter(struct pt_regs *regs);
void do_syscall_trace_leave(struct pt_regs *regs); void do_syscall_trace_leave(struct pt_regs *regs);
static inline void set_return_regs_changed(void)
{
#ifdef CONFIG_PPC_BOOK3S_64
local_paca->hsrr_valid = 0;
local_paca->srr_valid = 0;
#endif
}
static inline void regs_set_return_ip(struct pt_regs *regs, unsigned long ip) static inline void regs_set_return_ip(struct pt_regs *regs, unsigned long ip)
{ {
regs->nip = ip; regs->nip = ip;
@ -153,14 +161,6 @@ static inline void regs_set_return_msr(struct pt_regs *regs, unsigned long msr)
#endif #endif
} }
static inline void set_return_regs_changed(void)
{
#ifdef CONFIG_PPC_BOOK3S_64
local_paca->hsrr_valid = 0;
local_paca->srr_valid = 0;
#endif
}
static inline void regs_add_return_ip(struct pt_regs *regs, long offset) static inline void regs_add_return_ip(struct pt_regs *regs, long offset)
{ {
regs_set_return_ip(regs, regs->nip + offset); regs_set_return_ip(regs, regs->nip + offset);