aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kprobes.h
diff options
context:
space:
mode:
authorAnanth N Mavinakayanahalli <ananth@in.ibm.com>2005-11-07 04:00:07 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 10:53:45 -0500
commite65845235c8120be63001fc1a4ac00c819194bbe (patch)
tree209a081cc07375290743ceb45f52dc474f45382a /include/linux/kprobes.h
parent66ff2d0691e00e1e7bfdf398a970310c9a0fe671 (diff)
[PATCH] Kprobes: Track kprobe on a per_cpu basis - base changes
Changes to the base kprobe infrastructure to track kprobe execution on a per-cpu basis. Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/kprobes.h')
-rw-r--r--include/linux/kprobes.h31
1 files changed, 22 insertions, 9 deletions
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index e30afdca7917..6720305a31e8 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -33,6 +33,7 @@
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>
36 37
37#include <asm/kprobes.h> 38#include <asm/kprobes.h>
38 39
@@ -106,6 +107,9 @@ struct jprobe {
106 kprobe_opcode_t *entry; /* probe handling code to jump to */ 107 kprobe_opcode_t *entry; /* probe handling code to jump to */
107}; 108};
108 109
110DECLARE_PER_CPU(struct kprobe *, current_kprobe);
111DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
112
109#ifdef ARCH_SUPPORTS_KRETPROBES 113#ifdef ARCH_SUPPORTS_KRETPROBES
110extern void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs); 114extern void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs);
111#else /* ARCH_SUPPORTS_KRETPROBES */ 115#else /* ARCH_SUPPORTS_KRETPROBES */
@@ -146,13 +150,6 @@ struct kretprobe_instance {
146void lock_kprobes(void); 150void lock_kprobes(void);
147void unlock_kprobes(void); 151void unlock_kprobes(void);
148 152
149/* kprobe running now on this CPU? */
150static inline int kprobe_running(void)
151{
152 extern unsigned int kprobe_cpu;
153 return kprobe_cpu == smp_processor_id();
154}
155
156extern int arch_prepare_kprobe(struct kprobe *p); 153extern int arch_prepare_kprobe(struct kprobe *p);
157extern void arch_copy_kprobe(struct kprobe *p); 154extern void arch_copy_kprobe(struct kprobe *p);
158extern void arch_arm_kprobe(struct kprobe *p); 155extern void arch_arm_kprobe(struct kprobe *p);
@@ -167,6 +164,22 @@ extern void free_insn_slot(kprobe_opcode_t *slot);
167struct kprobe *get_kprobe(void *addr); 164struct kprobe *get_kprobe(void *addr);
168struct hlist_head * kretprobe_inst_table_head(struct task_struct *tsk); 165struct hlist_head * kretprobe_inst_table_head(struct task_struct *tsk);
169 166
167/* kprobe_running() will just return the current_kprobe on this CPU */
168static inline struct kprobe *kprobe_running(void)
169{
170 return (__get_cpu_var(current_kprobe));
171}
172
173static inline void reset_current_kprobe(void)
174{
175 __get_cpu_var(current_kprobe) = NULL;
176}
177
178static inline struct kprobe_ctlblk *get_kprobe_ctlblk(void)
179{
180 return (&__get_cpu_var(kprobe_ctlblk));
181}
182
170int register_kprobe(struct kprobe *p); 183int register_kprobe(struct kprobe *p);
171void unregister_kprobe(struct kprobe *p); 184void unregister_kprobe(struct kprobe *p);
172int setjmp_pre_handler(struct kprobe *, struct pt_regs *); 185int setjmp_pre_handler(struct kprobe *, struct pt_regs *);
@@ -183,9 +196,9 @@ void add_rp_inst(struct kretprobe_instance *ri);
183void kprobe_flush_task(struct task_struct *tk); 196void kprobe_flush_task(struct task_struct *tk);
184void recycle_rp_inst(struct kretprobe_instance *ri); 197void recycle_rp_inst(struct kretprobe_instance *ri);
185#else /* CONFIG_KPROBES */ 198#else /* CONFIG_KPROBES */
186static inline int kprobe_running(void) 199static inline struct kprobe *kprobe_running(void)
187{ 200{
188 return 0; 201 return NULL;
189} 202}
190static inline int register_kprobe(struct kprobe *p) 203static inline int register_kprobe(struct kprobe *p)
191{ 204{