2019-05-19 15:51:43 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2016-03-24 22:04:03 +11:00
|
|
|
/*
|
|
|
|
* livepatch.h - powerpc-specific Kernel Live Patching Core
|
|
|
|
*
|
|
|
|
* Copyright (C) 2015-2016, SUSE, IBM Corp.
|
|
|
|
*/
|
|
|
|
#ifndef _ASM_POWERPC_LIVEPATCH_H
|
|
|
|
#define _ASM_POWERPC_LIVEPATCH_H
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/ftrace.h>
|
2019-01-31 10:08:58 +00:00
|
|
|
#include <linux/sched/task_stack.h>
|
2016-03-24 22:04:03 +11:00
|
|
|
|
|
|
|
#ifdef CONFIG_LIVEPATCH
|
2020-10-28 17:15:27 -04:00
|
|
|
static inline void klp_arch_set_pc(struct ftrace_regs *fregs, unsigned long ip)
|
2016-03-24 22:04:03 +11:00
|
|
|
{
|
2021-12-20 16:38:28 +00:00
|
|
|
ftrace_instruction_pointer_set(fregs, ip);
|
2016-03-24 22:04:03 +11:00
|
|
|
}
|
2022-03-28 08:55:39 +11:00
|
|
|
#endif /* CONFIG_LIVEPATCH */
|
2016-03-24 22:04:03 +11:00
|
|
|
|
2021-12-20 16:38:12 +00:00
|
|
|
#ifdef CONFIG_LIVEPATCH_64
|
2019-01-31 10:08:58 +00:00
|
|
|
static inline void klp_init_thread_info(struct task_struct *p)
|
2016-03-24 22:04:04 +11:00
|
|
|
{
|
|
|
|
/* + 1 to account for STACK_END_MAGIC */
|
2019-01-31 10:08:58 +00:00
|
|
|
task_thread_info(p)->livepatch_sp = end_of_stack(p) + 1;
|
2016-03-24 22:04:04 +11:00
|
|
|
}
|
|
|
|
#else
|
2019-01-31 10:08:58 +00:00
|
|
|
static inline void klp_init_thread_info(struct task_struct *p) { }
|
2021-12-20 16:38:12 +00:00
|
|
|
#endif
|
2016-03-24 22:04:03 +11:00
|
|
|
|
|
|
|
#endif /* _ASM_POWERPC_LIVEPATCH_H */
|