hw-breakpoints: prepare the code for Hardware Breakpoint interfaces
[linux-2.6/x86.git] / arch / x86 / include / asm / hw_breakpoint.h
blob1acb4d45de70d10218f3c74fb930d70e8ace991f
1 #ifndef _I386_HW_BREAKPOINT_H
2 #define _I386_HW_BREAKPOINT_H
4 #ifdef __KERNEL__
5 #define __ARCH_HW_BREAKPOINT_H
7 struct arch_hw_breakpoint {
8 char *name; /* Contains name of the symbol to set bkpt */
9 unsigned long address;
10 u8 len;
11 u8 type;
14 #include <linux/kdebug.h>
15 #include <asm-generic/hw_breakpoint.h>
17 /* Available HW breakpoint length encodings */
18 #define HW_BREAKPOINT_LEN_1 0x40
19 #define HW_BREAKPOINT_LEN_2 0x44
20 #define HW_BREAKPOINT_LEN_4 0x4c
21 #define HW_BREAKPOINT_LEN_EXECUTE 0x40
23 #ifdef CONFIG_X86_64
24 #define HW_BREAKPOINT_LEN_8 0x48
25 #endif
27 /* Available HW breakpoint type encodings */
29 /* trigger on instruction execute */
30 #define HW_BREAKPOINT_EXECUTE 0x80
31 /* trigger on memory write */
32 #define HW_BREAKPOINT_WRITE 0x81
33 /* trigger on memory read or write */
34 #define HW_BREAKPOINT_RW 0x83
36 /* Total number of available HW breakpoint registers */
37 #define HBP_NUM 4
39 extern struct hw_breakpoint *hbp_kernel[HBP_NUM];
40 DECLARE_PER_CPU(struct hw_breakpoint*, this_hbp_kernel[HBP_NUM]);
41 extern unsigned int hbp_user_refcount[HBP_NUM];
43 extern void arch_install_thread_hw_breakpoint(struct task_struct *tsk);
44 extern void arch_uninstall_thread_hw_breakpoint(void);
45 extern int arch_check_va_in_userspace(unsigned long va, u8 hbp_len);
46 extern int arch_validate_hwbkpt_settings(struct hw_breakpoint *bp,
47 struct task_struct *tsk);
48 extern void arch_update_user_hw_breakpoint(int pos, struct task_struct *tsk);
49 extern void arch_flush_thread_hw_breakpoint(struct task_struct *tsk);
50 extern void arch_update_kernel_hw_breakpoint(void *);
51 extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused,
52 unsigned long val, void *data);
53 #endif /* __KERNEL__ */
54 #endif /* _I386_HW_BREAKPOINT_H */