diff options
author | K.Prasad <prasad@linux.vnet.ibm.com> | 2009-06-01 14:13:10 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2009-06-02 16:46:57 -0400 |
commit | b332828c39326b1dca617f387dd15d12e81cd5f0 (patch) | |
tree | b8cff4bd7a5b42a723e26d69cce4f3030bf68e62 /arch/x86/include/asm/hw_breakpoint.h | |
parent | 43bd1236234cacbc18d1476a9b57e7a306efddf5 (diff) |
hw-breakpoints: prepare the code for Hardware Breakpoint interfaces
The generic hardware breakpoint interface provides an abstraction of
hardware breakpoints in front of specific arch implementations for both kernel
and user side breakpoints.
This includes execution breakpoints and read/write breakpoints, also known as
"watchpoints".
This patch introduces header files containing constants, structure definitions
and declaration of functions used by the hardware breakpoint core and x86
specific code.
It also introduces an array based storage for the debug-register values in
'struct thread_struct', while modifying all users of debugreg<n> member in the
structure.
[ Impact: add headers for new hardware breakpoint interface ]
Original-patch-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: K.Prasad <prasad@linux.vnet.ibm.com>
Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'arch/x86/include/asm/hw_breakpoint.h')
-rw-r--r-- | arch/x86/include/asm/hw_breakpoint.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/arch/x86/include/asm/hw_breakpoint.h b/arch/x86/include/asm/hw_breakpoint.h new file mode 100644 index 000000000000..1acb4d45de70 --- /dev/null +++ b/arch/x86/include/asm/hw_breakpoint.h | |||
@@ -0,0 +1,55 @@ | |||
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> | ||
15 | #include <asm-generic/hw_breakpoint.h> | ||
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 | |||