Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Chris Smith | d39f545 | 2008-09-05 17:15:39 +0900 | [diff] [blame] | 2 | #ifndef __ASM_SH_KPROBES_H |
| 3 | #define __ASM_SH_KPROBES_H |
| 4 | |
Luis R. Rodriguez | 7d134b2 | 2017-02-27 14:26:56 -0800 | [diff] [blame] | 5 | #include <asm-generic/kprobes.h> |
| 6 | |
| 7 | #define BREAKPOINT_INSTRUCTION 0xc33a |
| 8 | |
Chris Smith | d39f545 | 2008-09-05 17:15:39 +0900 | [diff] [blame] | 9 | #ifdef CONFIG_KPROBES |
| 10 | |
| 11 | #include <linux/types.h> |
| 12 | #include <linux/ptrace.h> |
| 13 | |
Paul Mundt | 2bcfffa | 2009-05-09 16:02:08 +0900 | [diff] [blame] | 14 | typedef insn_size_t kprobe_opcode_t; |
Chris Smith | d39f545 | 2008-09-05 17:15:39 +0900 | [diff] [blame] | 15 | |
| 16 | #define MAX_INSN_SIZE 16 |
| 17 | #define MAX_STACK_SIZE 64 |
| 18 | #define MIN_STACK_SIZE(ADDR) (((MAX_STACK_SIZE) < \ |
| 19 | (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) \ |
| 20 | ? (MAX_STACK_SIZE) \ |
| 21 | : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) |
| 22 | |
Chris Smith | d39f545 | 2008-09-05 17:15:39 +0900 | [diff] [blame] | 23 | #define flush_insn_slot(p) do { } while (0) |
| 24 | #define kretprobe_blacklist_size 0 |
| 25 | |
| 26 | struct kprobe; |
| 27 | |
| 28 | void arch_remove_kprobe(struct kprobe *); |
| 29 | void kretprobe_trampoline(void); |
| 30 | void jprobe_return_end(void); |
| 31 | |
| 32 | /* Architecture specific copy of original instruction*/ |
| 33 | struct arch_specific_insn { |
| 34 | /* copy of the original instruction */ |
| 35 | kprobe_opcode_t insn[MAX_INSN_SIZE]; |
| 36 | }; |
| 37 | |
| 38 | struct prev_kprobe { |
| 39 | struct kprobe *kp; |
| 40 | unsigned long status; |
| 41 | }; |
| 42 | |
| 43 | /* per-cpu kprobe control block */ |
| 44 | struct kprobe_ctlblk { |
| 45 | unsigned long kprobe_status; |
| 46 | unsigned long jprobe_saved_r15; |
| 47 | struct pt_regs jprobe_saved_regs; |
| 48 | kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE]; |
| 49 | struct prev_kprobe prev_kprobe; |
| 50 | }; |
| 51 | |
Paul Mundt | 037c10a | 2008-09-08 12:22:47 +0900 | [diff] [blame] | 52 | extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); |
Chris Smith | d39f545 | 2008-09-05 17:15:39 +0900 | [diff] [blame] | 53 | extern int kprobe_exceptions_notify(struct notifier_block *self, |
| 54 | unsigned long val, void *data); |
| 55 | extern int kprobe_handle_illslot(unsigned long pc); |
| 56 | #else |
| 57 | |
| 58 | #define kprobe_handle_illslot(pc) (-1) |
| 59 | |
| 60 | #endif /* CONFIG_KPROBES */ |
| 61 | #endif /* __ASM_SH_KPROBES_H */ |