diff options
author | Paul Mackerras <paulus@samba.org> | 2005-11-07 19:14:20 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-11-07 19:14:20 -0500 |
commit | 24bfb00123e82a2e70bd115277d922438813515b (patch) | |
tree | 27328b8a5718e16d64e2d101f4b7ddcad5930aed /include/linux/kprobes.h | |
parent | c6135234550ed89a6fd0e8cb229633967e41d649 (diff) | |
parent | 3f00d3e8fb963968a922d821a9a53b503b687e81 (diff) |
Merge ../linux-2.6
Diffstat (limited to 'include/linux/kprobes.h')
-rw-r--r-- | include/linux/kprobes.h | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index e30afdca7917..e373c4a9de53 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
@@ -33,6 +33,9 @@ | |||
33 | #include <linux/list.h> | 33 | #include <linux/list.h> |
34 | #include <linux/notifier.h> | 34 | #include <linux/notifier.h> |
35 | #include <linux/smp.h> | 35 | #include <linux/smp.h> |
36 | #include <linux/percpu.h> | ||
37 | #include <linux/spinlock.h> | ||
38 | #include <linux/rcupdate.h> | ||
36 | 39 | ||
37 | #include <asm/kprobes.h> | 40 | #include <asm/kprobes.h> |
38 | 41 | ||
@@ -106,6 +109,9 @@ struct jprobe { | |||
106 | kprobe_opcode_t *entry; /* probe handling code to jump to */ | 109 | kprobe_opcode_t *entry; /* probe handling code to jump to */ |
107 | }; | 110 | }; |
108 | 111 | ||
112 | DECLARE_PER_CPU(struct kprobe *, current_kprobe); | ||
113 | DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); | ||
114 | |||
109 | #ifdef ARCH_SUPPORTS_KRETPROBES | 115 | #ifdef ARCH_SUPPORTS_KRETPROBES |
110 | extern void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs); | 116 | extern void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs); |
111 | #else /* ARCH_SUPPORTS_KRETPROBES */ | 117 | #else /* ARCH_SUPPORTS_KRETPROBES */ |
@@ -142,17 +148,7 @@ struct kretprobe_instance { | |||
142 | }; | 148 | }; |
143 | 149 | ||
144 | #ifdef CONFIG_KPROBES | 150 | #ifdef CONFIG_KPROBES |
145 | /* Locks kprobe: irq must be disabled */ | 151 | extern spinlock_t kretprobe_lock; |
146 | void lock_kprobes(void); | ||
147 | void unlock_kprobes(void); | ||
148 | |||
149 | /* kprobe running now on this CPU? */ | ||
150 | static inline int kprobe_running(void) | ||
151 | { | ||
152 | extern unsigned int kprobe_cpu; | ||
153 | return kprobe_cpu == smp_processor_id(); | ||
154 | } | ||
155 | |||
156 | extern int arch_prepare_kprobe(struct kprobe *p); | 152 | extern int arch_prepare_kprobe(struct kprobe *p); |
157 | extern void arch_copy_kprobe(struct kprobe *p); | 153 | extern void arch_copy_kprobe(struct kprobe *p); |
158 | extern void arch_arm_kprobe(struct kprobe *p); | 154 | extern void arch_arm_kprobe(struct kprobe *p); |
@@ -163,10 +159,26 @@ extern void show_registers(struct pt_regs *regs); | |||
163 | extern kprobe_opcode_t *get_insn_slot(void); | 159 | extern kprobe_opcode_t *get_insn_slot(void); |
164 | extern void free_insn_slot(kprobe_opcode_t *slot); | 160 | extern void free_insn_slot(kprobe_opcode_t *slot); |
165 | 161 | ||
166 | /* Get the kprobe at this addr (if any). Must have called lock_kprobes */ | 162 | /* Get the kprobe at this addr (if any) - called with preemption disabled */ |
167 | struct kprobe *get_kprobe(void *addr); | 163 | struct kprobe *get_kprobe(void *addr); |
168 | struct hlist_head * kretprobe_inst_table_head(struct task_struct *tsk); | 164 | struct hlist_head * kretprobe_inst_table_head(struct task_struct *tsk); |
169 | 165 | ||
166 | /* kprobe_running() will just return the current_kprobe on this CPU */ | ||
167 | static inline struct kprobe *kprobe_running(void) | ||
168 | { | ||
169 | return (__get_cpu_var(current_kprobe)); | ||
170 | } | ||
171 | |||
172 | static inline void reset_current_kprobe(void) | ||
173 | { | ||
174 | __get_cpu_var(current_kprobe) = NULL; | ||
175 | } | ||
176 | |||
177 | static inline struct kprobe_ctlblk *get_kprobe_ctlblk(void) | ||
178 | { | ||
179 | return (&__get_cpu_var(kprobe_ctlblk)); | ||
180 | } | ||
181 | |||
170 | int register_kprobe(struct kprobe *p); | 182 | int register_kprobe(struct kprobe *p); |
171 | void unregister_kprobe(struct kprobe *p); | 183 | void unregister_kprobe(struct kprobe *p); |
172 | int setjmp_pre_handler(struct kprobe *, struct pt_regs *); | 184 | int setjmp_pre_handler(struct kprobe *, struct pt_regs *); |
@@ -183,9 +195,9 @@ void add_rp_inst(struct kretprobe_instance *ri); | |||
183 | void kprobe_flush_task(struct task_struct *tk); | 195 | void kprobe_flush_task(struct task_struct *tk); |
184 | void recycle_rp_inst(struct kretprobe_instance *ri); | 196 | void recycle_rp_inst(struct kretprobe_instance *ri); |
185 | #else /* CONFIG_KPROBES */ | 197 | #else /* CONFIG_KPROBES */ |
186 | static inline int kprobe_running(void) | 198 | static inline struct kprobe *kprobe_running(void) |
187 | { | 199 | { |
188 | return 0; | 200 | return NULL; |
189 | } | 201 | } |
190 | static inline int register_kprobe(struct kprobe *p) | 202 | static inline int register_kprobe(struct kprobe *p) |
191 | { | 203 | { |