get rid of restarts in sync_filesystems()
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / linux / hw_breakpoint.h
bloba2d6ea49ec564e825ebffc3ebb059f57079fc73d
1 #ifndef _LINUX_HW_BREAKPOINT_H
2 #define _LINUX_HW_BREAKPOINT_H
4 enum {
5 HW_BREAKPOINT_LEN_1 = 1,
6 HW_BREAKPOINT_LEN_2 = 2,
7 HW_BREAKPOINT_LEN_4 = 4,
8 HW_BREAKPOINT_LEN_8 = 8,
9 };
11 enum {
12 HW_BREAKPOINT_EMPTY = 0,
13 HW_BREAKPOINT_R = 1,
14 HW_BREAKPOINT_W = 2,
15 HW_BREAKPOINT_RW = HW_BREAKPOINT_R | HW_BREAKPOINT_W,
16 HW_BREAKPOINT_X = 4,
17 HW_BREAKPOINT_INVALID = HW_BREAKPOINT_RW | HW_BREAKPOINT_X,
20 enum bp_type_idx {
21 TYPE_INST = 0,
22 #ifdef CONFIG_HAVE_MIXED_BREAKPOINTS_REGS
23 TYPE_DATA = 0,
24 #else
25 TYPE_DATA = 1,
26 #endif
27 TYPE_MAX
30 #ifdef __KERNEL__
32 #include <linux/perf_event.h>
34 #ifdef CONFIG_HAVE_HW_BREAKPOINT
36 static inline void hw_breakpoint_init(struct perf_event_attr *attr)
38 memset(attr, 0, sizeof(*attr));
40 attr->type = PERF_TYPE_BREAKPOINT;
41 attr->size = sizeof(*attr);
43 * As it's for in-kernel or ptrace use, we want it to be pinned
44 * and to call its callback every hits.
46 attr->pinned = 1;
47 attr->sample_period = 1;
50 static inline void ptrace_breakpoint_init(struct perf_event_attr *attr)
52 hw_breakpoint_init(attr);
53 attr->exclude_kernel = 1;
56 static inline unsigned long hw_breakpoint_addr(struct perf_event *bp)
58 return bp->attr.bp_addr;
61 static inline int hw_breakpoint_type(struct perf_event *bp)
63 return bp->attr.bp_type;
66 static inline unsigned long hw_breakpoint_len(struct perf_event *bp)
68 return bp->attr.bp_len;
71 extern struct perf_event *
72 register_user_hw_breakpoint(struct perf_event_attr *attr,
73 perf_overflow_handler_t triggered,
74 struct task_struct *tsk);
76 /* FIXME: only change from the attr, and don't unregister */
77 extern int
78 modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *attr);
81 * Kernel breakpoints are not associated with any particular thread.
83 extern struct perf_event *
84 register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr,
85 perf_overflow_handler_t triggered,
86 int cpu);
88 extern struct perf_event * __percpu *
89 register_wide_hw_breakpoint(struct perf_event_attr *attr,
90 perf_overflow_handler_t triggered);
92 extern int register_perf_hw_breakpoint(struct perf_event *bp);
93 extern int __register_perf_hw_breakpoint(struct perf_event *bp);
94 extern void unregister_hw_breakpoint(struct perf_event *bp);
95 extern void unregister_wide_hw_breakpoint(struct perf_event * __percpu *cpu_events);
97 extern int dbg_reserve_bp_slot(struct perf_event *bp);
98 extern int dbg_release_bp_slot(struct perf_event *bp);
99 extern int reserve_bp_slot(struct perf_event *bp);
100 extern void release_bp_slot(struct perf_event *bp);
102 extern void flush_ptrace_hw_breakpoint(struct task_struct *tsk);
104 static inline struct arch_hw_breakpoint *counter_arch_bp(struct perf_event *bp)
106 return &bp->hw.info;
109 #else /* !CONFIG_HAVE_HW_BREAKPOINT */
111 static inline struct perf_event *
112 register_user_hw_breakpoint(struct perf_event_attr *attr,
113 perf_overflow_handler_t triggered,
114 struct task_struct *tsk) { return NULL; }
115 static inline int
116 modify_user_hw_breakpoint(struct perf_event *bp,
117 struct perf_event_attr *attr) { return -ENOSYS; }
118 static inline struct perf_event *
119 register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr,
120 perf_overflow_handler_t triggered,
121 int cpu) { return NULL; }
122 static inline struct perf_event * __percpu *
123 register_wide_hw_breakpoint(struct perf_event_attr *attr,
124 perf_overflow_handler_t triggered) { return NULL; }
125 static inline int
126 register_perf_hw_breakpoint(struct perf_event *bp) { return -ENOSYS; }
127 static inline int
128 __register_perf_hw_breakpoint(struct perf_event *bp) { return -ENOSYS; }
129 static inline void unregister_hw_breakpoint(struct perf_event *bp) { }
130 static inline void
131 unregister_wide_hw_breakpoint(struct perf_event * __percpu *cpu_events) { }
132 static inline int
133 reserve_bp_slot(struct perf_event *bp) {return -ENOSYS; }
134 static inline void release_bp_slot(struct perf_event *bp) { }
136 static inline void flush_ptrace_hw_breakpoint(struct task_struct *tsk) { }
138 static inline struct arch_hw_breakpoint *counter_arch_bp(struct perf_event *bp)
140 return NULL;
143 #endif /* CONFIG_HAVE_HW_BREAKPOINT */
144 #endif /* __KERNEL__ */
146 #endif /* _LINUX_HW_BREAKPOINT_H */