xref: /openbmc/linux/arch/arm64/include/asm/kprobes.h (revision cfbb9be8)
1 /*
2  * arch/arm64/include/asm/kprobes.h
3  *
4  * Copyright (C) 2013 Linaro Limited
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  */
15 
16 #ifndef _ARM_KPROBES_H
17 #define _ARM_KPROBES_H
18 
19 #include <asm-generic/kprobes.h>
20 
21 #ifdef CONFIG_KPROBES
22 #include <linux/types.h>
23 #include <linux/ptrace.h>
24 #include <linux/percpu.h>
25 
26 #define __ARCH_WANT_KPROBES_INSN_SLOT
27 #define MAX_INSN_SIZE			1
28 
29 #define flush_insn_slot(p)		do { } while (0)
30 #define kretprobe_blacklist_size	0
31 
32 #include <asm/probes.h>
33 
34 struct prev_kprobe {
35 	struct kprobe *kp;
36 	unsigned int status;
37 };
38 
39 /* Single step context for kprobe */
40 struct kprobe_step_ctx {
41 	unsigned long ss_pending;
42 	unsigned long match_addr;
43 };
44 
45 /* per-cpu kprobe control block */
46 struct kprobe_ctlblk {
47 	unsigned int kprobe_status;
48 	unsigned long saved_irqflag;
49 	struct prev_kprobe prev_kprobe;
50 	struct kprobe_step_ctx ss_ctx;
51 	struct pt_regs jprobe_saved_regs;
52 };
53 
54 void arch_remove_kprobe(struct kprobe *);
55 int kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr);
56 int kprobe_exceptions_notify(struct notifier_block *self,
57 			     unsigned long val, void *data);
58 int kprobe_breakpoint_handler(struct pt_regs *regs, unsigned int esr);
59 int kprobe_single_step_handler(struct pt_regs *regs, unsigned int esr);
60 void kretprobe_trampoline(void);
61 void __kprobes *trampoline_probe_handler(struct pt_regs *regs);
62 
63 #endif /* CONFIG_KPROBES */
64 #endif /* _ARM_KPROBES_H */
65