summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/alternative.c
diff options
context:
space:
mode:
authorJuergen Gross <jgross@suse.com>2023-11-29 14:33:29 +0100
committerBorislav Petkov (AMD) <bp@alien8.de>2023-12-10 20:30:31 +0100
commit9824b00c2b58f9e1072ef3ece571a2cfc71089d4 (patch)
treea4bc9c4efb42ef53c3893735156f491c20feda4d /arch/x86/kernel/alternative.c
parentx86/paravirt: Introduce ALT_NOT_XEN (diff)
downloadlinux-9824b00c2b58f9e1072ef3ece571a2cfc71089d4.tar.xz
linux-9824b00c2b58f9e1072ef3ece571a2cfc71089d4.zip
x86/paravirt: Move some functions and defines to alternative.c
As a preparation for replacing paravirt patching completely by alternative patching, move some backend functions and #defines to the alternatives code and header. Signed-off-by: Juergen Gross <jgross@suse.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/20231129133332.31043-3-jgross@suse.com
Diffstat (limited to 'arch/x86/kernel/alternative.c')
-rw-r--r--arch/x86/kernel/alternative.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index be35c8ccf826..ca25dd280b8c 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -385,6 +385,16 @@ apply_relocation(u8 *buf, size_t len, u8 *dest, u8 *src, size_t src_len)
}
}
+/* Low-level backend functions usable from alternative code replacements. */
+DEFINE_ASM_FUNC(nop_func, "", .entry.text);
+EXPORT_SYMBOL_GPL(nop_func);
+
+noinstr void BUG_func(void)
+{
+ BUG();
+}
+EXPORT_SYMBOL_GPL(BUG_func);
+
/*
* Replace instructions with better alternatives for this CPU type. This runs
* before SMP is initialized to avoid SMP problems with self modifying code.