xref: /openbmc/linux/arch/sparc/include/asm/kprobes.h (revision d47a97bd)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _SPARC64_KPROBES_H
3 #define _SPARC64_KPROBES_H
4 
5 #include <asm-generic/kprobes.h>
6 
7 #define BREAKPOINT_INSTRUCTION   0x91d02070 /* ta 0x70 */
8 #define BREAKPOINT_INSTRUCTION_2 0x91d02071 /* ta 0x71 */
9 
10 #ifdef CONFIG_KPROBES
11 #include <linux/types.h>
12 #include <linux/percpu.h>
13 
14 typedef u32 kprobe_opcode_t;
15 
16 #define MAX_INSN_SIZE 2
17 
18 #define kretprobe_blacklist_size 0
19 
20 #define arch_remove_kprobe(p)	do {} while (0)
21 
22 #define flush_insn_slot(p)		\
23 do { 	flushi(&(p)->ainsn.insn[0]);	\
24 	flushi(&(p)->ainsn.insn[1]);	\
25 } while (0)
26 
27 void __kretprobe_trampoline(void);
28 
29 /* Architecture specific copy of original instruction*/
30 struct arch_specific_insn {
31 	/* copy of the original instruction */
32 	kprobe_opcode_t insn[MAX_INSN_SIZE];
33 };
34 
35 struct prev_kprobe {
36 	struct kprobe *kp;
37 	unsigned long status;
38 	unsigned long orig_tnpc;
39 	unsigned long orig_tstate_pil;
40 };
41 
42 /* per-cpu kprobe control block */
43 struct kprobe_ctlblk {
44 	unsigned long kprobe_status;
45 	unsigned long kprobe_orig_tnpc;
46 	unsigned long kprobe_orig_tstate_pil;
47 	struct prev_kprobe prev_kprobe;
48 };
49 
50 int kprobe_exceptions_notify(struct notifier_block *self,
51 			     unsigned long val, void *data);
52 int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
53 asmlinkage void __kprobes kprobe_trap(unsigned long trap_level,
54 				      struct pt_regs *regs);
55 
56 #endif /* CONFIG_KPROBES */
57 #endif /* _SPARC64_KPROBES_H */
58