18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _SPARC64_KPROBES_H
38c2ecf20Sopenharmony_ci#define _SPARC64_KPROBES_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <asm-generic/kprobes.h>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#define BREAKPOINT_INSTRUCTION   0x91d02070 /* ta 0x70 */
88c2ecf20Sopenharmony_ci#define BREAKPOINT_INSTRUCTION_2 0x91d02071 /* ta 0x71 */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#ifdef CONFIG_KPROBES
118c2ecf20Sopenharmony_ci#include <linux/types.h>
128c2ecf20Sopenharmony_ci#include <linux/percpu.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_citypedef u32 kprobe_opcode_t;
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define MAX_INSN_SIZE 2
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#define kretprobe_blacklist_size 0
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define arch_remove_kprobe(p)	do {} while (0)
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#define flush_insn_slot(p)		\
238c2ecf20Sopenharmony_cido { 	flushi(&(p)->ainsn.insn[0]);	\
248c2ecf20Sopenharmony_ci	flushi(&(p)->ainsn.insn[1]);	\
258c2ecf20Sopenharmony_ci} while (0)
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_civoid kretprobe_trampoline(void);
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci/* Architecture specific copy of original instruction*/
308c2ecf20Sopenharmony_cistruct arch_specific_insn {
318c2ecf20Sopenharmony_ci	/* copy of the original instruction */
328c2ecf20Sopenharmony_ci	kprobe_opcode_t insn[MAX_INSN_SIZE];
338c2ecf20Sopenharmony_ci};
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_cistruct prev_kprobe {
368c2ecf20Sopenharmony_ci	struct kprobe *kp;
378c2ecf20Sopenharmony_ci	unsigned long status;
388c2ecf20Sopenharmony_ci	unsigned long orig_tnpc;
398c2ecf20Sopenharmony_ci	unsigned long orig_tstate_pil;
408c2ecf20Sopenharmony_ci};
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci/* per-cpu kprobe control block */
438c2ecf20Sopenharmony_cistruct kprobe_ctlblk {
448c2ecf20Sopenharmony_ci	unsigned long kprobe_status;
458c2ecf20Sopenharmony_ci	unsigned long kprobe_orig_tnpc;
468c2ecf20Sopenharmony_ci	unsigned long kprobe_orig_tstate_pil;
478c2ecf20Sopenharmony_ci	struct prev_kprobe prev_kprobe;
488c2ecf20Sopenharmony_ci};
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ciint kprobe_exceptions_notify(struct notifier_block *self,
518c2ecf20Sopenharmony_ci			     unsigned long val, void *data);
528c2ecf20Sopenharmony_ciint kprobe_fault_handler(struct pt_regs *regs, int trapnr);
538c2ecf20Sopenharmony_ciasmlinkage void __kprobes kprobe_trap(unsigned long trap_level,
548c2ecf20Sopenharmony_ci				      struct pt_regs *regs);
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci#endif /* CONFIG_KPROBES */
578c2ecf20Sopenharmony_ci#endif /* _SPARC64_KPROBES_H */
58