From f684199f5de805ac50ea5bdec2b082882586a777 Mon Sep 17 00:00:00 2001 From: Masami Hiramatsu Date: Fri, 28 Sep 2012 17:15:22 +0900 Subject: [PATCH] kprobes/x86: Move kprobes stuff under arch/x86/kernel/kprobes/ Move arch-dep kprobes stuff under arch/x86/kernel/kprobes. Link: http://lkml.kernel.org/r/20120928081522.3560.75469.stgit@ltc138.sdl.hitachi.co.jp Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Frederic Weisbecker Cc: Ananth N Mavinakayanahalli Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Signed-off-by: Masami Hiramatsu [ fixed whitespace and s/__attribute__((packed))/__packed/ ] Signed-off-by: Steven Rostedt --- arch/x86/kernel/Makefile | 4 +--- arch/x86/kernel/kprobes/Makefile | 7 +++++++ arch/x86/kernel/{kprobes-common.h => kprobes/common.h} | 0 arch/x86/kernel/{kprobes.c => kprobes/core.c} | 6 +++--- arch/x86/kernel/{kprobes-ftrace.c => kprobes/ftrace.c} | 2 +- arch/x86/kernel/{kprobes-opt.c => kprobes/opt.c} | 2 +- 6 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 arch/x86/kernel/kprobes/Makefile rename arch/x86/kernel/{kprobes-common.h => kprobes/common.h} (100%) rename arch/x86/kernel/{kprobes.c => kprobes/core.c} (99%) rename arch/x86/kernel/{kprobes-ftrace.c => kprobes/ftrace.c} (98%) rename arch/x86/kernel/{kprobes-opt.c => kprobes/opt.c} (99%) diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index cc5d31f8830c..ac3b3d002833 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile @@ -65,9 +65,7 @@ obj-$(CONFIG_X86_TSC) += trace_clock.o obj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o -obj-$(CONFIG_KPROBES) += kprobes.o -obj-$(CONFIG_OPTPROBES) += kprobes-opt.o -obj-$(CONFIG_KPROBES_ON_FTRACE) += kprobes-ftrace.o +obj-y += kprobes/ obj-$(CONFIG_MODULES) += module.o obj-$(CONFIG_DOUBLEFAULT) += doublefault_32.o obj-$(CONFIG_KGDB) += kgdb.o diff --git a/arch/x86/kernel/kprobes/Makefile b/arch/x86/kernel/kprobes/Makefile new file mode 100644 index 000000000000..0d33169cc1a2 --- /dev/null +++ b/arch/x86/kernel/kprobes/Makefile @@ -0,0 +1,7 @@ +# +# Makefile for kernel probes +# + +obj-$(CONFIG_KPROBES) += core.o +obj-$(CONFIG_OPTPROBES) += opt.o +obj-$(CONFIG_KPROBES_ON_FTRACE) += ftrace.o diff --git a/arch/x86/kernel/kprobes-common.h b/arch/x86/kernel/kprobes/common.h similarity index 100% rename from arch/x86/kernel/kprobes-common.h rename to arch/x86/kernel/kprobes/common.h diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes/core.c similarity index 99% rename from arch/x86/kernel/kprobes.c rename to arch/x86/kernel/kprobes/core.c index 18114bfb10f3..e124554598ee 100644 --- a/arch/x86/kernel/kprobes.c +++ b/arch/x86/kernel/kprobes/core.c @@ -58,7 +58,7 @@ #include #include -#include "kprobes-common.h" +#include "common.h" void jprobe_return_end(void); @@ -78,7 +78,7 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); * Groups, and some special opcodes can not boost. * This is non-const and volatile to keep gcc from statically * optimizing it out, as variable_test_bit makes gcc think only - * *(unsigned long*) is used. + * *(unsigned long*) is used. */ static volatile u32 twobyte_is_boostable[256 / 32] = { /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ @@ -117,7 +117,7 @@ static void __kprobes __synthesize_relative_insn(void *from, void *to, u8 op) struct __arch_relative_insn { u8 op; s32 raddr; - } __attribute__((packed)) *insn; + } __packed *insn; insn = (struct __arch_relative_insn *)from; insn->raddr = (s32)((long)(to) - ((long)(from) + 5)); diff --git a/arch/x86/kernel/kprobes-ftrace.c b/arch/x86/kernel/kprobes/ftrace.c similarity index 98% rename from arch/x86/kernel/kprobes-ftrace.c rename to arch/x86/kernel/kprobes/ftrace.c index 70a81c7aa0a7..23ef5c556f06 100644 --- a/arch/x86/kernel/kprobes-ftrace.c +++ b/arch/x86/kernel/kprobes/ftrace.c @@ -23,7 +23,7 @@ #include #include -#include "kprobes-common.h" +#include "common.h" static int __skip_singlestep(struct kprobe *p, struct pt_regs *regs, struct kprobe_ctlblk *kcb) diff --git a/arch/x86/kernel/kprobes-opt.c b/arch/x86/kernel/kprobes/opt.c similarity index 99% rename from arch/x86/kernel/kprobes-opt.c rename to arch/x86/kernel/kprobes/opt.c index c5e410eed403..76dc6f095724 100644 --- a/arch/x86/kernel/kprobes-opt.c +++ b/arch/x86/kernel/kprobes/opt.c @@ -37,7 +37,7 @@ #include #include -#include "kprobes-common.h" +#include "common.h" unsigned long __recover_optprobed_insn(kprobe_opcode_t *buf, unsigned long addr) { -- 2.30.2