]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
x86: Add insn_decode_kernel()
authorBen Hutchings <ben@decadent.org.uk>
Sun, 10 Jul 2022 22:43:31 +0000 (00:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Jul 2022 09:26:12 +0000 (11:26 +0200)
This was done by commit 52fa82c21f64e900a72437269a5cc9e0034b424e
upstream, but this backport avoids changing all callers of the
old decoder API.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/include/asm/insn.h
arch/x86/kernel/alternative.c
tools/arch/x86/include/asm/insn.h

index 546436b3c2154bfd3f07efd406019d5185b92dcb..0da37756917a9a03d07cb9a1b782dc1addf79bee 100644 (file)
@@ -105,6 +105,8 @@ enum insn_mode {
 
 extern int insn_decode(struct insn *insn, const void *kaddr, int buf_len, enum insn_mode m);
 
+#define insn_decode_kernel(_insn, _ptr) insn_decode((_insn), (_ptr), MAX_INSN_SIZE, INSN_MODE_KERN)
+
 /* Attribute will be determined after getting ModRM (for opcode groups) */
 static inline void insn_get_attribute(struct insn *insn)
 {
index 9da3267ec3b55106e68b63e9ec82c39ccfad5ef7..75b9ab3d7099d78e781825af74240301ecea4add 100644 (file)
@@ -1290,7 +1290,7 @@ static void text_poke_loc_init(struct text_poke_loc *tp, void *addr,
        if (!emulate)
                emulate = opcode;
 
-       ret = insn_decode(&insn, emulate, MAX_INSN_SIZE, INSN_MODE_KERN);
+       ret = insn_decode_kernel(&insn, emulate);
 
        BUG_ON(ret < 0);
        BUG_ON(len != insn.length);
index 621ab64a6d2723c0f8860b4d4be7ae8c8900e50c..636ec02793a78ece6375a1b1ce570609643f4d7b 100644 (file)
@@ -105,6 +105,8 @@ enum insn_mode {
 
 extern int insn_decode(struct insn *insn, const void *kaddr, int buf_len, enum insn_mode m);
 
+#define insn_decode_kernel(_insn, _ptr) insn_decode((_insn), (_ptr), MAX_INSN_SIZE, INSN_MODE_KERN)
+
 /* Attribute will be determined after getting ModRM (for opcode groups) */
 static inline void insn_get_attribute(struct insn *insn)
 {