[PATCH 13/14] x86: Move MAX_INSN_SIZE into asm/insn.h

Peter Zijlstra
2010-03-04T14:02:08Z

[-- Attachment #1: x86-collect-max_insn_size.patch --]
[-- Type: text/plain, Size: 1984 bytes --]

Since there's now two users for this, place it in a common header.

CC: Masami Hiramatsu <mhiramat@redhat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
---
arch/x86/include/asm/insn.h | 2 ++
arch/x86/include/asm/kprobes.h | 2 +-
arch/x86/kernel/cpu/perf_event_intel_ds.c | 2 --
3 files changed, 3 insertions(+), 3 deletions(-)

Index: linux-2.6/arch/x86/include/asm/insn.h
===================================================================
--- linux-2.6.orig/arch/x86/include/asm/insn.h
+++ linux-2.6/arch/x86/include/asm/insn.h
@@ -68,6 +68,8 @@ struct insn {
const insn_byte_t *next_byte;
};

+#define MAX_INSN_SIZE 16
+
#define X86_MODRM_MOD(modrm) (((modrm) & 0xc0) >> 6)
#define X86_MODRM_REG(modrm) (((modrm) & 0x38) >> 3)
#define X86_MODRM_RM(modrm) ((modrm) & 0x07)
Index: linux-2.6/arch/x86/include/asm/kprobes.h
===================================================================
--- linux-2.6.orig/arch/x86/include/asm/kprobes.h
+++ linux-2.6/arch/x86/include/asm/kprobes.h
@@ -24,6 +24,7 @@
#include <linux/types.h>
#include <linux/ptrace.h>
#include <linux/percpu.h>
+#include <asm/insn.h>

#define __ARCH_WANT_KPROBES_INSN_SLOT

@@ -36,7 +37,6 @@ typedef u8 kprobe_opcode_t;
#define RELATIVEJUMP_SIZE 5
#define RELATIVECALL_OPCODE 0xe8
#define RELATIVE_ADDR_SIZE 4
-#define MAX_INSN_SIZE 16
#define MAX_STACK_SIZE 64
#define MIN_STACK_SIZE(ADDR) \
(((MAX_STACK_SIZE) < (((unsigned long)current_thread_info()) + \
Index: linux-2.6/arch/x86/kernel/cpu/perf_event_intel_ds.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ linux-2.6/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -379,8 +379,6 @@ static void intel_pmu_pebs_disable_all(v

#include <asm/insn.h>

-#define MAX_INSN_SIZE 16
-
static inline bool kernel_ip(unsigned long ip)
{
#ifdef CONFIG_X86_32

--