6 #include <linux/kernel.h>
8 #include <linux/module.h>
10 #include <linux/slab.h>
11 #include <asm/signal.h>
12 #include <asm/cacheflush.h>
13 #include <asm/uaccess.h>
50 if ((
unsigned long) p->
addr & 0x3UL)
106 regs->tpc = (
unsigned long) p->
addr;
109 regs->tpc = (
unsigned long) &p->
ainsn.insn[0];
110 regs->tnpc = (
unsigned long) &p->
ainsn.insn[1];
117 void *
addr = (
void *) regs->tpc;
126 kcb = get_kprobe_ctlblk();
128 if (kprobe_running()) {
132 regs->tstate = ((regs->tstate & ~
TSTATE_PIL) |
142 save_previous_kprobe(kcb);
143 set_current_kprobe(p, regs, kcb);
146 prepare_singlestep(p, regs, kcb);
180 set_current_kprobe(p, regs, kcb);
186 prepare_singlestep(p, regs, kcb);
206 unsigned long real_pc = (
unsigned long) p->
addr;
209 if (regs->tnpc == regs->tpc + 0x4UL)
210 return real_pc + 0x8
UL;
215 if ((insn & 0xc0000000) == 0x40000000 ||
216 (insn & 0xc1c00000) == 0x00400000 ||
217 (insn & 0xc1c00000) == 0x00800000) {
218 unsigned long ainsn_addr;
220 ainsn_addr = (
unsigned long) &p->
ainsn.insn[0];
226 return (real_pc + (regs->tnpc - ainsn_addr));
239 unsigned long real_pc)
244 if ((insn & 0xc0000000) == 0x40000000) {
249 if ((insn & 0xc1f80000) == 0x81c00000) {
250 unsigned long rd = ((insn >> 25) & 0x1f);
259 slot = (
unsigned long *)
284 regs->tnpc = relbranch_fixup(insn, p, regs);
289 retpc_fixup(regs, insn, (
unsigned long) p->
addr);
291 regs->tstate = ((regs->tstate & ~
TSTATE_PIL) |
308 resume_execution(cur, regs, kcb);
312 restore_previous_kprobe(kcb);
315 reset_current_kprobe();
324 struct kprobe *cur = kprobe_running();
338 regs->tpc = (
unsigned long)cur->
addr;
340 regs->tstate = ((regs->tstate & ~
TSTATE_PIL) |
343 restore_previous_kprobe(kcb);
345 reset_current_kprobe();
349 case KPROBE_HIT_SSDONE:
374 regs->tpc = entry->
fixup;
375 regs->tnpc = regs->tpc + 4;
398 int ret = NOTIFY_DONE;
409 if (post_kprobe_handler(args->
regs))
421 BUG_ON(trap_level != 0x170 && trap_level != 0x171);
433 (trap_level == 0x170) ?
"debug" :
"debug_2",
434 regs, 0, trap_level,
SIGTRAP) != NOTIFY_STOP)
447 regs->tnpc = ((
unsigned long) jp->
entry) + 0x4UL;
456 register unsigned long orig_fp
asm(
"g1");
460 "1: cmp %%sp, %0\n\t"
461 "blu,a,pt %%xcc, 1b\n\t"
463 ".globl jprobe_return_trap_instruction\n"
464 "jprobe_return_trap_instruction:\n\t"
474 u32 *addr = (
u32 *) regs->tpc;
515 unsigned long flags, orig_ret_address = 0;
539 if (ri->
rp && ri->
rp->handler)
540 ri->
rp->handler(ri, regs);
545 if (orig_ret_address != trampoline_address)
554 kretprobe_assert(ri, orig_ret_address, trampoline_address);
555 regs->tpc = orig_ret_address;
556 regs->tnpc = orig_ret_address + 4;
558 reset_current_kprobe();
563 hlist_del(&ri->
hlist);
576 asm volatile(
".global kretprobe_trampoline\n"
577 "kretprobe_trampoline:\n"
581 static struct kprobe trampoline_p = {