xref: /linux/arch/riscv/include/asm/probes.h (revision d0034a7a4ac7fae708146ac0059b9c47a1543f0d)
1*c22b0bcbSGuo Ren /* SPDX-License-Identifier: GPL-2.0 */
2*c22b0bcbSGuo Ren 
3*c22b0bcbSGuo Ren #ifndef _ASM_RISCV_PROBES_H
4*c22b0bcbSGuo Ren #define _ASM_RISCV_PROBES_H
5*c22b0bcbSGuo Ren 
6*c22b0bcbSGuo Ren typedef u32 probe_opcode_t;
7*c22b0bcbSGuo Ren typedef bool (probes_handler_t) (u32 opcode, unsigned long addr, struct pt_regs *);
8*c22b0bcbSGuo Ren 
9*c22b0bcbSGuo Ren /* architecture specific copy of original instruction */
10*c22b0bcbSGuo Ren struct arch_probe_insn {
11*c22b0bcbSGuo Ren 	probe_opcode_t *insn;
12*c22b0bcbSGuo Ren 	probes_handler_t *handler;
13*c22b0bcbSGuo Ren 	/* restore address after simulation */
14*c22b0bcbSGuo Ren 	unsigned long restore;
15*c22b0bcbSGuo Ren };
16*c22b0bcbSGuo Ren 
17*c22b0bcbSGuo Ren #ifdef CONFIG_KPROBES
18*c22b0bcbSGuo Ren typedef u32 kprobe_opcode_t;
19*c22b0bcbSGuo Ren struct arch_specific_insn {
20*c22b0bcbSGuo Ren 	struct arch_probe_insn api;
21*c22b0bcbSGuo Ren };
22*c22b0bcbSGuo Ren #endif
23*c22b0bcbSGuo Ren 
24*c22b0bcbSGuo Ren #endif /* _ASM_RISCV_PROBES_H */
25