^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) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * arch/parisc/include/asm/kprobes.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * PA-RISC kprobes implementation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Copyright (c) 2019 Sven Schnelle <svens@stackframe.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #ifndef _PARISC_KPROBES_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #define _PARISC_KPROBES_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #ifdef CONFIG_KPROBES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <asm-generic/kprobes.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/ptrace.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/notifier.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define PARISC_KPROBES_BREAK_INSN 0x3ff801f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #define __ARCH_WANT_KPROBES_INSN_SLOT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define MAX_INSN_SIZE 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) typedef u32 kprobe_opcode_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) struct kprobe;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) void arch_remove_kprobe(struct kprobe *p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define flush_insn_slot(p) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) flush_icache_range((unsigned long)&(p)->ainsn.insn[0], \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) (unsigned long)&(p)->ainsn.insn[0] + \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) sizeof(kprobe_opcode_t))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define kretprobe_blacklist_size 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) struct arch_specific_insn {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) kprobe_opcode_t *insn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) struct prev_kprobe {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) struct kprobe *kp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) unsigned long status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) struct kprobe_ctlblk {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) unsigned int kprobe_status;
^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) unsigned long iaoq[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) int __kprobes parisc_kprobe_break_handler(struct pt_regs *regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) int __kprobes parisc_kprobe_ss_handler(struct pt_regs *regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #endif /* CONFIG_KPROBES */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) #endif /* _PARISC_KPROBES_H */