forked from Minki/linux
MIPS/kprobes: Remove jprobe implementation
Remove arch dependent setjump/longjump functions and unused fields in kprobe_ctlblk for jprobes from arch/mips. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Acked-by: Thomas Gleixner <tglx@linutronix.de> Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: James Hogan <jhogan@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: linux-arch@vger.kernel.org Cc: linux-mips@linux-mips.org Link: https://lore.kernel.org/lkml/152942451058.15209.3459785416221980965.stgit@devbox Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
0aeaf6b3a3
commit
8c2c3f2d40
@ -68,16 +68,6 @@ struct prev_kprobe {
|
||||
unsigned long saved_epc;
|
||||
};
|
||||
|
||||
#define MAX_JPROBES_STACK_SIZE 128
|
||||
#define MAX_JPROBES_STACK_ADDR \
|
||||
(((unsigned long)current_thread_info()) + THREAD_SIZE - 32 - sizeof(struct pt_regs))
|
||||
|
||||
#define MIN_JPROBES_STACK_SIZE(ADDR) \
|
||||
((((ADDR) + MAX_JPROBES_STACK_SIZE) > MAX_JPROBES_STACK_ADDR) \
|
||||
? MAX_JPROBES_STACK_ADDR - (ADDR) \
|
||||
: MAX_JPROBES_STACK_SIZE)
|
||||
|
||||
|
||||
#define SKIP_DELAYSLOT 0x0001
|
||||
|
||||
/* per-cpu kprobe control block */
|
||||
@ -86,12 +76,9 @@ struct kprobe_ctlblk {
|
||||
unsigned long kprobe_old_SR;
|
||||
unsigned long kprobe_saved_SR;
|
||||
unsigned long kprobe_saved_epc;
|
||||
unsigned long jprobe_saved_sp;
|
||||
struct pt_regs jprobe_saved_regs;
|
||||
/* Per-thread fields, used while emulating branches */
|
||||
unsigned long flags;
|
||||
unsigned long target_epc;
|
||||
u8 jprobes_stack[MAX_JPROBES_STACK_SIZE];
|
||||
struct prev_kprobe prev_kprobe;
|
||||
};
|
||||
|
||||
|
@ -468,51 +468,6 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
|
||||
{
|
||||
struct jprobe *jp = container_of(p, struct jprobe, kp);
|
||||
struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
|
||||
|
||||
kcb->jprobe_saved_regs = *regs;
|
||||
kcb->jprobe_saved_sp = regs->regs[29];
|
||||
|
||||
memcpy(kcb->jprobes_stack, (void *)kcb->jprobe_saved_sp,
|
||||
MIN_JPROBES_STACK_SIZE(kcb->jprobe_saved_sp));
|
||||
|
||||
regs->cp0_epc = (unsigned long)(jp->entry);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Defined in the inline asm below. */
|
||||
void jprobe_return_end(void);
|
||||
|
||||
void __kprobes jprobe_return(void)
|
||||
{
|
||||
/* Assembler quirk necessitates this '0,code' business. */
|
||||
asm volatile(
|
||||
"break 0,%0\n\t"
|
||||
".globl jprobe_return_end\n"
|
||||
"jprobe_return_end:\n"
|
||||
: : "n" (BRK_KPROBE_BP) : "memory");
|
||||
}
|
||||
|
||||
int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
|
||||
{
|
||||
struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
|
||||
|
||||
if (regs->cp0_epc >= (unsigned long)jprobe_return &&
|
||||
regs->cp0_epc <= (unsigned long)jprobe_return_end) {
|
||||
*regs = kcb->jprobe_saved_regs;
|
||||
memcpy((void *)kcb->jprobe_saved_sp, kcb->jprobes_stack,
|
||||
MIN_JPROBES_STACK_SIZE(kcb->jprobe_saved_sp));
|
||||
preempt_enable_no_resched();
|
||||
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Function return probe trampoline:
|
||||
* - init_kprobes() establishes a probepoint here
|
||||
|
Loading…
Reference in New Issue
Block a user