1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2d39f5450SChris Smith #ifndef __ASM_SH_KPROBES_H 3d39f5450SChris Smith #define __ASM_SH_KPROBES_H 4d39f5450SChris Smith 57d134b2cSLuis R. Rodriguez #include <asm-generic/kprobes.h> 67d134b2cSLuis R. Rodriguez 77d134b2cSLuis R. Rodriguez #define BREAKPOINT_INSTRUCTION 0xc33a 87d134b2cSLuis R. Rodriguez 9d39f5450SChris Smith #ifdef CONFIG_KPROBES 10d39f5450SChris Smith 11d39f5450SChris Smith #include <linux/types.h> 12d39f5450SChris Smith #include <linux/ptrace.h> 13d39f5450SChris Smith 142bcfffa4SPaul Mundt typedef insn_size_t kprobe_opcode_t; 15d39f5450SChris Smith 16d39f5450SChris Smith #define MAX_INSN_SIZE 16 17d39f5450SChris Smith #define MAX_STACK_SIZE 64 18d39f5450SChris Smith #define MIN_STACK_SIZE(ADDR) (((MAX_STACK_SIZE) < \ 19d39f5450SChris Smith (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) \ 20d39f5450SChris Smith ? (MAX_STACK_SIZE) \ 21d39f5450SChris Smith : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) 22d39f5450SChris Smith 23d39f5450SChris Smith #define flush_insn_slot(p) do { } while (0) 24d39f5450SChris Smith #define kretprobe_blacklist_size 0 25d39f5450SChris Smith 26d39f5450SChris Smith struct kprobe; 27d39f5450SChris Smith 28d39f5450SChris Smith void arch_remove_kprobe(struct kprobe *); 29*adf8a61aSMasami Hiramatsu void __kretprobe_trampoline(void); 30d39f5450SChris Smith 31d39f5450SChris Smith /* Architecture specific copy of original instruction*/ 32d39f5450SChris Smith struct arch_specific_insn { 33d39f5450SChris Smith /* copy of the original instruction */ 34d39f5450SChris Smith kprobe_opcode_t insn[MAX_INSN_SIZE]; 35d39f5450SChris Smith }; 36d39f5450SChris Smith 37d39f5450SChris Smith struct prev_kprobe { 38d39f5450SChris Smith struct kprobe *kp; 39d39f5450SChris Smith unsigned long status; 40d39f5450SChris Smith }; 41d39f5450SChris Smith 42d39f5450SChris Smith /* per-cpu kprobe control block */ 43d39f5450SChris Smith struct kprobe_ctlblk { 44d39f5450SChris Smith unsigned long kprobe_status; 45d39f5450SChris Smith struct prev_kprobe prev_kprobe; 46d39f5450SChris Smith }; 47d39f5450SChris Smith 48037c10a6SPaul Mundt extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); 49d39f5450SChris Smith extern int kprobe_exceptions_notify(struct notifier_block *self, 50d39f5450SChris Smith unsigned long val, void *data); 51d39f5450SChris Smith extern int kprobe_handle_illslot(unsigned long pc); 52d39f5450SChris Smith #else 53d39f5450SChris Smith 54d39f5450SChris Smith #define kprobe_handle_illslot(pc) (-1) 55d39f5450SChris Smith 56d39f5450SChris Smith #endif /* CONFIG_KPROBES */ 57d39f5450SChris Smith #endif /* __ASM_SH_KPROBES_H */ 58