This source file includes following definitions.
- arch_prepared_optinsn
1
2 #ifndef _ASM_X86_KPROBES_H
3 #define _ASM_X86_KPROBES_H
4
5
6
7
8
9
10
11
12 #include <asm-generic/kprobes.h>
13
14 #define BREAKPOINT_INSTRUCTION 0xcc
15
16 #ifdef CONFIG_KPROBES
17 #include <linux/types.h>
18 #include <linux/ptrace.h>
19 #include <linux/percpu.h>
20 #include <asm/insn.h>
21
22 #define __ARCH_WANT_KPROBES_INSN_SLOT
23
24 struct pt_regs;
25 struct kprobe;
26
27 typedef u8 kprobe_opcode_t;
28 #define RELATIVEJUMP_OPCODE 0xe9
29 #define RELATIVEJUMP_SIZE 5
30 #define RELATIVECALL_OPCODE 0xe8
31 #define RELATIVE_ADDR_SIZE 4
32 #define MAX_STACK_SIZE 64
33 #define CUR_STACK_SIZE(ADDR) \
34 (current_top_of_stack() - (unsigned long)(ADDR))
35 #define MIN_STACK_SIZE(ADDR) \
36 (MAX_STACK_SIZE < CUR_STACK_SIZE(ADDR) ? \
37 MAX_STACK_SIZE : CUR_STACK_SIZE(ADDR))
38
39 #define flush_insn_slot(p) do { } while (0)
40
41
42 extern __visible kprobe_opcode_t optprobe_template_entry[];
43 extern __visible kprobe_opcode_t optprobe_template_val[];
44 extern __visible kprobe_opcode_t optprobe_template_call[];
45 extern __visible kprobe_opcode_t optprobe_template_end[];
46 #define MAX_OPTIMIZED_LENGTH (MAX_INSN_SIZE + RELATIVE_ADDR_SIZE)
47 #define MAX_OPTINSN_SIZE \
48 (((unsigned long)optprobe_template_end - \
49 (unsigned long)optprobe_template_entry) + \
50 MAX_OPTIMIZED_LENGTH + RELATIVEJUMP_SIZE)
51
52 extern const int kretprobe_blacklist_size;
53
54 void arch_remove_kprobe(struct kprobe *p);
55 asmlinkage void kretprobe_trampoline(void);
56
57 extern void arch_kprobe_override_function(struct pt_regs *regs);
58
59
60 struct arch_specific_insn {
61
62 kprobe_opcode_t *insn;
63
64
65
66
67
68
69
70 bool boostable;
71 bool if_modifier;
72 };
73
74 struct arch_optimized_insn {
75
76 kprobe_opcode_t copied_insn[RELATIVE_ADDR_SIZE];
77
78 kprobe_opcode_t *insn;
79
80 size_t size;
81 };
82
83
84 static inline int arch_prepared_optinsn(struct arch_optimized_insn *optinsn)
85 {
86 return optinsn->size;
87 }
88
89 struct prev_kprobe {
90 struct kprobe *kp;
91 unsigned long status;
92 unsigned long old_flags;
93 unsigned long saved_flags;
94 };
95
96
97 struct kprobe_ctlblk {
98 unsigned long kprobe_status;
99 unsigned long kprobe_old_flags;
100 unsigned long kprobe_saved_flags;
101 struct prev_kprobe prev_kprobe;
102 };
103
104 extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
105 extern int kprobe_exceptions_notify(struct notifier_block *self,
106 unsigned long val, void *data);
107 extern int kprobe_int3_handler(struct pt_regs *regs);
108 extern int kprobe_debug_handler(struct pt_regs *regs);
109
110 #endif
111 #endif