From 33e53ae1ce413a081254e686d9b27cc1b3585e2f Mon Sep 17 00:00:00 2001 From: Guo Ren Date: Wed, 1 Apr 2020 09:17:02 +0800 Subject: csky: Add kprobes supported This patch enable kprobes, kretprobes, ftrace interface. It utilized software breakpoint and single step debug exceptions, instructions simulation on csky. We use USR_BKPT replace origin instruction, and the kprobe handler prepares an excutable memory slot for out-of-line execution with a copy of the original instruction being probed. Most of instructions could be executed by single-step, but some instructions need origin pc value to execute and we need software simulate these instructions. Signed-off-by: Guo Ren Cc: Arnd Bergmann Cc: Steven Rostedt (VMware) --- arch/csky/mm/fault.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'arch/csky/mm') diff --git a/arch/csky/mm/fault.c b/arch/csky/mm/fault.c index 562c7f708749..d3c61b83e195 100644 --- a/arch/csky/mm/fault.c +++ b/arch/csky/mm/fault.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -53,6 +54,9 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write, int fault; unsigned long address = mmu_meh & PAGE_MASK; + if (kprobe_page_fault(regs, tsk->thread.trap_no)) + return; + si_code = SEGV_MAPERR; #ifndef CONFIG_CPU_HAS_TLBI -- cgit v1.2.3