From: Anil S Keshavamurthy Kernel/kprobes.c defines get_insn_slot() and free_insn_slot() which are currently required _only_ for x86_64 and powerpc (which has no-exec support). FYI, get{free}_insn_slot() functions manages the memory page which is mapped as executable, required for instruction emulation. This patch moves those two functions under __ARCH_WANT_KPROBES_INSN_SLOT and defines __ARCH_WANT_KPROBES_INSN_SLOT in arch specific kprobes.h file. Signed-off-by: Anil S Keshavamurthy Signed-off-by: Andrew Morton --- include/asm-powerpc/kprobes.h | 2 ++ include/asm-x86_64/kprobes.h | 2 ++ kernel/kprobes.c | 2 ++ 3 files changed, 6 insertions(+) diff -puN include/asm-powerpc/kprobes.h~kprobes-enable-funcions-only-for-required-arch include/asm-powerpc/kprobes.h --- devel/include/asm-powerpc/kprobes.h~kprobes-enable-funcions-only-for-required-arch 2005-12-22 05:09:45.000000000 -0800 +++ devel-akpm/include/asm-powerpc/kprobes.h 2005-12-22 05:09:45.000000000 -0800 @@ -30,6 +30,8 @@ #include #include +#define __ARCH_WANT_KPROBES_INSN_SLOT + struct pt_regs; typedef unsigned int kprobe_opcode_t; diff -puN include/asm-x86_64/kprobes.h~kprobes-enable-funcions-only-for-required-arch include/asm-x86_64/kprobes.h --- devel/include/asm-x86_64/kprobes.h~kprobes-enable-funcions-only-for-required-arch 2005-12-22 05:09:45.000000000 -0800 +++ devel-akpm/include/asm-x86_64/kprobes.h 2005-12-22 05:09:45.000000000 -0800 @@ -27,6 +27,8 @@ #include #include +#define __ARCH_WANT_KPROBES_INSN_SLOT + struct pt_regs; typedef u8 kprobe_opcode_t; diff -puN kernel/kprobes.c~kprobes-enable-funcions-only-for-required-arch kernel/kprobes.c --- devel/kernel/kprobes.c~kprobes-enable-funcions-only-for-required-arch 2005-12-22 05:09:45.000000000 -0800 +++ devel-akpm/kernel/kprobes.c 2005-12-22 05:09:45.000000000 -0800 @@ -52,6 +52,7 @@ static DEFINE_SPINLOCK(kprobe_lock); /* DEFINE_SPINLOCK(kretprobe_lock); /* Protects kretprobe_inst_table */ static DEFINE_PER_CPU(struct kprobe *, kprobe_instance) = NULL; +#ifdef __ARCH_WANT_KPROBES_INSN_SLOT /* * kprobe->ainsn.insn points to the copy of the instruction to be * single-stepped. x86_64, POWER4 and above have no-exec support and @@ -151,6 +152,7 @@ void __kprobes free_insn_slot(kprobe_opc } } } +#endif /* We have preemption disabled.. so it is safe to use __ versions */ static inline void set_kprobe_instance(struct kprobe *kp) _