K.Prasad | b332828c | 2009-06-01 23:43:10 +0530 | [diff] [blame] | 1 | #ifndef _I386_HW_BREAKPOINT_H |
| 2 | #define _I386_HW_BREAKPOINT_H |
| 3 | |
| 4 | #ifdef __KERNEL__ |
| 5 | #define __ARCH_HW_BREAKPOINT_H |
| 6 | |
| 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; |
| 12 | }; |
| 13 | |
| 14 | #include <linux/kdebug.h> |
Frederic Weisbecker | 2da3e16 | 2009-11-05 23:06:50 +0100 | [diff] [blame^] | 15 | #include <linux/hw_breakpoint.h> |
K.Prasad | b332828c | 2009-06-01 23:43:10 +0530 | [diff] [blame] | 16 | |
| 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 |
| 22 | |
| 23 | #ifdef CONFIG_X86_64 |
| 24 | #define HW_BREAKPOINT_LEN_8 0x48 |
| 25 | #endif |
| 26 | |
| 27 | /* Available HW breakpoint type encodings */ |
| 28 | |
| 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 |
| 35 | |
| 36 | /* Total number of available HW breakpoint registers */ |
| 37 | #define HBP_NUM 4 |
| 38 | |
| 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]; |
| 42 | |
| 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 */ |
| 55 | |