x86: mmiotrace - trace memory mapped IO
[linux-2.6-block.git] / arch / x86 / kernel / mmiotrace / kmmio.h
1 #ifndef _LINUX_KMMIO_H
2 #define _LINUX_KMMIO_H
3
4 #include <linux/list.h>
5 #include <linux/notifier.h>
6 #include <linux/smp.h>
7 #include <linux/types.h>
8 #include <linux/ptrace.h>
9 #include <linux/version.h>
10 #include <linux/kdebug.h>
11
12 struct kmmio_probe;
13 struct kmmio_fault_page;
14 struct pt_regs;
15
16 typedef void (*kmmio_pre_handler_t)(struct kmmio_probe *,
17                                 struct pt_regs *, unsigned long addr);
18 typedef void (*kmmio_post_handler_t)(struct kmmio_probe *,
19                                 unsigned long condition, struct pt_regs *);
20
21 struct kmmio_probe {
22         struct list_head list;
23
24         /* start location of the probe point */
25         unsigned long addr;
26
27         /* length of the probe region */
28         unsigned long len;
29
30          /* Called before addr is executed. */
31         kmmio_pre_handler_t pre_handler;
32
33         /* Called after addr is executed, unless... */
34         kmmio_post_handler_t post_handler;
35 };
36
37 struct kmmio_fault_page {
38         struct list_head list;
39
40         /* location of the fault page */
41         unsigned long page;
42
43         int count;
44 };
45
46 /* kmmio is active by some kmmio_probes? */
47 static inline int is_kmmio_active(void)
48 {
49         extern unsigned int kmmio_count;
50         return kmmio_count;
51 }
52
53 int init_kmmio(void);
54 void cleanup_kmmio(void);
55 int register_kmmio_probe(struct kmmio_probe *p);
56 void unregister_kmmio_probe(struct kmmio_probe *p);
57
58 #endif /* _LINUX_KMMIO_H */