aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/ia64/kernel/jprobes.S3
-rw-r--r--arch/ia64/kernel/kprobes.c51
-rw-r--r--include/asm-ia64/break.h4
-rw-r--r--include/asm-ia64/kprobes.h1
4 files changed, 42 insertions, 17 deletions
diff --git a/arch/ia64/kernel/jprobes.S b/arch/ia64/kernel/jprobes.S
index 5cd6226f44f2..621630256c4a 100644
--- a/arch/ia64/kernel/jprobes.S
+++ b/arch/ia64/kernel/jprobes.S
@@ -45,13 +45,14 @@
45 * to the correct location. 45 * to the correct location.
46 */ 46 */
47#include <asm/asmmacro.h> 47#include <asm/asmmacro.h>
48#include <asm-ia64/break.h>
48 49
49 /* 50 /*
50 * void jprobe_break(void) 51 * void jprobe_break(void)
51 */ 52 */
52 .section .kprobes.text, "ax" 53 .section .kprobes.text, "ax"
53ENTRY(jprobe_break) 54ENTRY(jprobe_break)
54 break.m 0x80300 55 break.m __IA64_BREAK_JPROBE
55END(jprobe_break) 56END(jprobe_break)
56 57
57 /* 58 /*
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c
index 76e778951e20..8406d24d516b 100644
--- a/arch/ia64/kernel/kprobes.c
+++ b/arch/ia64/kernel/kprobes.c
@@ -88,6 +88,7 @@ static void __kprobes update_kprobe_inst_flag(uint template, uint slot,
88{ 88{
89 p->ainsn.inst_flag = 0; 89 p->ainsn.inst_flag = 0;
90 p->ainsn.target_br_reg = 0; 90 p->ainsn.target_br_reg = 0;
91 p->ainsn.slot = slot;
91 92
92 /* Check for Break instruction 93 /* Check for Break instruction
93 * Bits 37:40 Major opcode to be zero 94 * Bits 37:40 Major opcode to be zero
@@ -296,12 +297,6 @@ static int __kprobes valid_kprobe_addr(int template, int slot,
296 return -EINVAL; 297 return -EINVAL;
297 } 298 }
298 299
299 if (slot == 1 && bundle_encoding[template][1] != L) {
300 printk(KERN_WARNING "Inserting kprobes on slot #1 "
301 "is not supported\n");
302 return -EINVAL;
303 }
304
305 return 0; 300 return 0;
306} 301}
307 302
@@ -458,23 +453,49 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
458 453
459void __kprobes arch_arm_kprobe(struct kprobe *p) 454void __kprobes arch_arm_kprobe(struct kprobe *p)
460{ 455{
461 unsigned long addr = (unsigned long)p->addr; 456 unsigned long arm_addr;
462 unsigned long arm_addr = addr & ~0xFULL; 457 bundle_t *src, *dest;
458
459 arm_addr = ((unsigned long)p->addr) & ~0xFUL;
460 dest = &((kprobe_opcode_t *)arm_addr)->bundle;
461 src = &p->opcode.bundle;
463 462
464 flush_icache_range((unsigned long)p->ainsn.insn, 463 flush_icache_range((unsigned long)p->ainsn.insn,
465 (unsigned long)p->ainsn.insn + sizeof(kprobe_opcode_t)); 464 (unsigned long)p->ainsn.insn + sizeof(kprobe_opcode_t));
466 memcpy((char *)arm_addr, &p->opcode, sizeof(kprobe_opcode_t)); 465 switch (p->ainsn.slot) {
466 case 0:
467 dest->quad0.slot0 = src->quad0.slot0;
468 break;
469 case 1:
470 dest->quad1.slot1_p1 = src->quad1.slot1_p1;
471 break;
472 case 2:
473 dest->quad1.slot2 = src->quad1.slot2;
474 break;
475 }
467 flush_icache_range(arm_addr, arm_addr + sizeof(kprobe_opcode_t)); 476 flush_icache_range(arm_addr, arm_addr + sizeof(kprobe_opcode_t));
468} 477}
469 478
470void __kprobes arch_disarm_kprobe(struct kprobe *p) 479void __kprobes arch_disarm_kprobe(struct kprobe *p)
471{ 480{
472 unsigned long addr = (unsigned long)p->addr; 481 unsigned long arm_addr;
473 unsigned long arm_addr = addr & ~0xFULL; 482 bundle_t *src, *dest;
474 483
484 arm_addr = ((unsigned long)p->addr) & ~0xFUL;
485 dest = &((kprobe_opcode_t *)arm_addr)->bundle;
475 /* p->ainsn.insn contains the original unaltered kprobe_opcode_t */ 486 /* p->ainsn.insn contains the original unaltered kprobe_opcode_t */
476 memcpy((char *) arm_addr, (char *) p->ainsn.insn, 487 src = &p->ainsn.insn->bundle;
477 sizeof(kprobe_opcode_t)); 488 switch (p->ainsn.slot) {
489 case 0:
490 dest->quad0.slot0 = src->quad0.slot0;
491 break;
492 case 1:
493 dest->quad1.slot1_p1 = src->quad1.slot1_p1;
494 break;
495 case 2:
496 dest->quad1.slot2 = src->quad1.slot2;
497 break;
498 }
478 flush_icache_range(arm_addr, arm_addr + sizeof(kprobe_opcode_t)); 499 flush_icache_range(arm_addr, arm_addr + sizeof(kprobe_opcode_t));
479} 500}
480 501
@@ -807,7 +828,9 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
807 switch(val) { 828 switch(val) {
808 case DIE_BREAK: 829 case DIE_BREAK:
809 /* err is break number from ia64_bad_break() */ 830 /* err is break number from ia64_bad_break() */
810 if (args->err == 0x80200 || args->err == 0x80300 || args->err == 0) 831 if ((args->err >> 12) == (__IA64_BREAK_KPROBE >> 12)
832 || args->err == __IA64_BREAK_JPROBE
833 || args->err == 0)
811 if (pre_kprobes_handler(args)) 834 if (pre_kprobes_handler(args))
812 ret = NOTIFY_STOP; 835 ret = NOTIFY_STOP;
813 break; 836 break;
diff --git a/include/asm-ia64/break.h b/include/asm-ia64/break.h
index 8167828edc4b..f03402039896 100644
--- a/include/asm-ia64/break.h
+++ b/include/asm-ia64/break.h
@@ -12,8 +12,8 @@
12 * OS-specific debug break numbers: 12 * OS-specific debug break numbers:
13 */ 13 */
14#define __IA64_BREAK_KDB 0x80100 14#define __IA64_BREAK_KDB 0x80100
15#define __IA64_BREAK_KPROBE 0x80200 15#define __IA64_BREAK_KPROBE 0x81000 /* .. 0x81fff */
16#define __IA64_BREAK_JPROBE 0x80300 16#define __IA64_BREAK_JPROBE 0x82000
17 17
18/* 18/*
19 * OS-specific break numbers: 19 * OS-specific break numbers:
diff --git a/include/asm-ia64/kprobes.h b/include/asm-ia64/kprobes.h
index 1b45b71c79b9..828ae00e47c1 100644
--- a/include/asm-ia64/kprobes.h
+++ b/include/asm-ia64/kprobes.h
@@ -115,6 +115,7 @@ struct arch_specific_insn {
115 #define INST_FLAG_BREAK_INST 4 115 #define INST_FLAG_BREAK_INST 4
116 unsigned long inst_flag; 116 unsigned long inst_flag;
117 unsigned short target_br_reg; 117 unsigned short target_br_reg;
118 unsigned short slot;
118}; 119};
119 120
120extern int kprobe_exceptions_notify(struct notifier_block *self, 121extern int kprobe_exceptions_notify(struct notifier_block *self,