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