aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2007-02-06 23:55:19 -0500
committerKumar Gala <galak@kernel.crashing.org>2007-02-06 23:55:19 -0500
commit8209003547c4b1006943eac8dc6c1fb6493cafda (patch)
tree37ed5742527d448f211c575fe714fe68846e0c40 /arch
parent8423200553113cc031caa9b147f6150a8e26545c (diff)
[POWERPC] Added kprobes support to ppc32
Added kprobes to ppc32 platforms that have use single_step_exception. This excludes 4xx and anything Book-E since their debug mechanisms for single stepping are completely different. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/Kconfig2
-rw-r--r--arch/powerpc/kernel/kprobes.c8
-rw-r--r--arch/powerpc/lib/Makefile2
3 files changed, 8 insertions, 4 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index aeb53096acf7..0b6325a77c75 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -1206,7 +1206,7 @@ source "arch/powerpc/oprofile/Kconfig"
1206 1206
1207config KPROBES 1207config KPROBES
1208 bool "Kprobes (EXPERIMENTAL)" 1208 bool "Kprobes (EXPERIMENTAL)"
1209 depends on PPC64 && KALLSYMS && EXPERIMENTAL && MODULES 1209 depends on !BOOKE && !4xx && KALLSYMS && EXPERIMENTAL && MODULES
1210 help 1210 help
1211 Kprobes allows you to trap at almost any kernel address and 1211 Kprobes allows you to trap at almost any kernel address and
1212 execute a callback function. register_kprobe() establishes 1212 execute a callback function. register_kprobe() establishes
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index 4657563f8813..dd2886f97e98 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -46,8 +46,8 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
46 if ((unsigned long)p->addr & 0x03) { 46 if ((unsigned long)p->addr & 0x03) {
47 printk("Attempt to register kprobe at an unaligned address\n"); 47 printk("Attempt to register kprobe at an unaligned address\n");
48 ret = -EINVAL; 48 ret = -EINVAL;
49 } else if (IS_MTMSRD(insn) || IS_RFID(insn)) { 49 } else if (IS_MTMSRD(insn) || IS_RFID(insn) || IS_RFI(insn)) {
50 printk("Cannot register a kprobe on rfid or mtmsrd\n"); 50 printk("Cannot register a kprobe on rfi/rfid or mtmsr[d]\n");
51 ret = -EINVAL; 51 ret = -EINVAL;
52 } 52 }
53 53
@@ -483,8 +483,12 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
483 memcpy(&kcb->jprobe_saved_regs, regs, sizeof(struct pt_regs)); 483 memcpy(&kcb->jprobe_saved_regs, regs, sizeof(struct pt_regs));
484 484
485 /* setup return addr to the jprobe handler routine */ 485 /* setup return addr to the jprobe handler routine */
486#ifdef CONFIG_PPC64
486 regs->nip = (unsigned long)(((func_descr_t *)jp->entry)->entry); 487 regs->nip = (unsigned long)(((func_descr_t *)jp->entry)->entry);
487 regs->gpr[2] = (unsigned long)(((func_descr_t *)jp->entry)->toc); 488 regs->gpr[2] = (unsigned long)(((func_descr_t *)jp->entry)->toc);
489#else
490 regs->nip = (unsigned long)jp->entry;
491#endif
488 492
489 return 1; 493 return 1;
490} 494}
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index e2d414160c83..4b1ba49fbd9e 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -16,11 +16,11 @@ obj-$(CONFIG_PPC64) += checksum_64.o copypage_64.o copyuser_64.o \
16 strcase.o 16 strcase.o
17obj-$(CONFIG_QUICC_ENGINE) += rheap.o 17obj-$(CONFIG_QUICC_ENGINE) += rheap.o
18obj-$(CONFIG_XMON) += sstep.o 18obj-$(CONFIG_XMON) += sstep.o
19obj-$(CONFIG_KPROBES) += sstep.o
19obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-noncoherent.o 20obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-noncoherent.o
20 21
21ifeq ($(CONFIG_PPC64),y) 22ifeq ($(CONFIG_PPC64),y)
22obj-$(CONFIG_SMP) += locks.o 23obj-$(CONFIG_SMP) += locks.o
23obj-$(CONFIG_DEBUG_KERNEL) += sstep.o
24endif 24endif
25 25
26# Temporary hack until we have migrated to asm-powerpc 26# Temporary hack until we have migrated to asm-powerpc