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 <guoren@linux.alibaba.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
24
arch/csky/include/asm/probes.h
Normal file
24
arch/csky/include/asm/probes.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
|
||||
#ifndef __ASM_CSKY_PROBES_H
|
||||
#define __ASM_CSKY_PROBES_H
|
||||
|
||||
typedef u32 probe_opcode_t;
|
||||
typedef void (probes_handler_t) (u32 opcode, long addr, struct pt_regs *);
|
||||
|
||||
/* architecture specific copy of original instruction */
|
||||
struct arch_probe_insn {
|
||||
probe_opcode_t *insn;
|
||||
probes_handler_t *handler;
|
||||
/* restore address after simulation */
|
||||
unsigned long restore;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_KPROBES
|
||||
typedef u32 kprobe_opcode_t;
|
||||
struct arch_specific_insn {
|
||||
struct arch_probe_insn api;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* __ASM_CSKY_PROBES_H */
|
Reference in New Issue
Block a user