Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 46884
b: refs/heads/master
c: 8209003
h: refs/heads/master
v: v3
  • Loading branch information
Kumar Gala committed Feb 7, 2007
1 parent c9dcd72 commit 2350822
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8423200553113cc031caa9b147f6150a8e26545c
refs/heads/master: 8209003547c4b1006943eac8dc6c1fb6493cafda
2 changes: 1 addition & 1 deletion trunk/arch/powerpc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,7 @@ source "arch/powerpc/oprofile/Kconfig"

config KPROBES
bool "Kprobes (EXPERIMENTAL)"
depends on PPC64 && KALLSYMS && EXPERIMENTAL && MODULES
depends on !BOOKE && !4xx && KALLSYMS && EXPERIMENTAL && MODULES
help
Kprobes allows you to trap at almost any kernel address and
execute a callback function. register_kprobe() establishes
Expand Down
8 changes: 6 additions & 2 deletions trunk/arch/powerpc/kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
if ((unsigned long)p->addr & 0x03) {
printk("Attempt to register kprobe at an unaligned address\n");
ret = -EINVAL;
} else if (IS_MTMSRD(insn) || IS_RFID(insn)) {
printk("Cannot register a kprobe on rfid or mtmsrd\n");
} else if (IS_MTMSRD(insn) || IS_RFID(insn) || IS_RFI(insn)) {
printk("Cannot register a kprobe on rfi/rfid or mtmsr[d]\n");
ret = -EINVAL;
}

Expand Down Expand Up @@ -483,8 +483,12 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
memcpy(&kcb->jprobe_saved_regs, regs, sizeof(struct pt_regs));

/* setup return addr to the jprobe handler routine */
#ifdef CONFIG_PPC64
regs->nip = (unsigned long)(((func_descr_t *)jp->entry)->entry);
regs->gpr[2] = (unsigned long)(((func_descr_t *)jp->entry)->toc);
#else
regs->nip = (unsigned long)jp->entry;
#endif

return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/powerpc/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ obj-$(CONFIG_PPC64) += checksum_64.o copypage_64.o copyuser_64.o \
strcase.o
obj-$(CONFIG_QUICC_ENGINE) += rheap.o
obj-$(CONFIG_XMON) += sstep.o
obj-$(CONFIG_KPROBES) += sstep.o
obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-noncoherent.o

ifeq ($(CONFIG_PPC64),y)
obj-$(CONFIG_SMP) += locks.o
obj-$(CONFIG_DEBUG_KERNEL) += sstep.o
endif

# Temporary hack until we have migrated to asm-powerpc
Expand Down
7 changes: 6 additions & 1 deletion trunk/include/asm-powerpc/kprobes.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ typedef unsigned int kprobe_opcode_t;
#define IS_TDI(instr) (((instr) & 0xfc000000) == 0x08000000)
#define IS_TWI(instr) (((instr) & 0xfc000000) == 0x0c000000)

#ifdef CONFIG_PPC64
/*
* 64bit powerpc uses function descriptors.
* Handle cases where:
Expand All @@ -67,9 +68,13 @@ typedef unsigned int kprobe_opcode_t;
}

#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)((func_descr_t *)pentry)

#define is_trap(instr) (IS_TW(instr) || IS_TD(instr) || \
IS_TWI(instr) || IS_TDI(instr))
#else
/* Use stock kprobe_lookup_name since ppc32 doesn't use function descriptors */
#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)(pentry)
#define is_trap(instr) (IS_TW(instr) || IS_TWI(instr))
#endif

#define ARCH_SUPPORTS_KRETPROBES
#define ARCH_INACTIVE_KPROBE_COUNT 1
Expand Down
1 change: 1 addition & 0 deletions trunk/include/asm-powerpc/sstep.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ struct pt_regs;
*/
#define IS_MTMSRD(instr) (((instr) & 0xfc0007be) == 0x7c000124)
#define IS_RFID(instr) (((instr) & 0xfc0007fe) == 0x4c000024)
#define IS_RFI(instr) (((instr) & 0xfc0007fe) == 0x4c000064)

/* Emulate instructions that cause a transfer of control. */
extern int emulate_step(struct pt_regs *regs, unsigned int instr);

0 comments on commit 2350822

Please sign in to comment.