[PATCH] kprobes: enable funcions only for required arch
authorAnil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Tue, 10 Jan 2006 04:52:41 +0000 (20:52 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 10 Jan 2006 16:01:39 +0000 (08:01 -0800)
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 <anil.s.keshavamurthy@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/asm-powerpc/kprobes.h
include/asm-x86_64/kprobes.h
kernel/kprobes.c

index 0654f79b06df9b81c9c00816ae0a4e9408924c1e..7c98e547c6d85e89b6f9c2afeacb01899a5094c1 100644 (file)
@@ -30,6 +30,8 @@
 #include <linux/ptrace.h>
 #include <linux/percpu.h>
 
+#define  __ARCH_WANT_KPROBES_INSN_SLOT
+
 struct pt_regs;
 
 typedef unsigned int kprobe_opcode_t;
index 4dd7a7e148d450d6ba93c347c655cc8975ac8230..9e2532adf42c3171ea7471e7af4a5239620f32e6 100644 (file)
@@ -27,6 +27,8 @@
 #include <linux/ptrace.h>
 #include <linux/percpu.h>
 
+#define  __ARCH_WANT_KPROBES_INSN_SLOT
+
 struct pt_regs;
 
 typedef u8 kprobe_opcode_t;
index 3bb71e63a37e0bfa47217c99b2b5e6dbe0a8f2d5..3897630d2335c6fd7a65c0387515930058aebc82 100644 (file)
@@ -52,6 +52,7 @@ static DEFINE_SPINLOCK(kprobe_lock);  /* Protects kprobe_table */
 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_opcode_t *slot)
                }
        }
 }
+#endif
 
 /* We have preemption disabled.. so it is safe to use __ versions */
 static inline void set_kprobe_instance(struct kprobe *kp)