diff options
author | K.Prasad <prasad@linux.vnet.ibm.com> | 2009-06-01 14:14:55 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2009-06-02 16:46:59 -0400 |
commit | 66cb5917295958652ff6ba36d83f98f2379c46b4 (patch) | |
tree | 1e30c4524cb5d53ecd4980b83ead4e9548dfb8f5 /arch/x86/kernel/process.c | |
parent | 1e3500666f7c5daaadadb8431a2927cdbbdb7dd4 (diff) |
hw-breakpoints: use the new wrapper routines to access debug registers in process/thread code
This patch enables the use of abstract debug registers in
process-handling routines, according to the new hardware breakpoint
Api.
[ Impact: adapt thread breakpoints handling code to the new breakpoint Api ]
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/kernel/process.c')
-rw-r--r-- | arch/x86/kernel/process.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 291527cb438a..19a686c401b5 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -15,6 +15,8 @@ | |||
15 | #include <asm/uaccess.h> | 15 | #include <asm/uaccess.h> |
16 | #include <asm/i387.h> | 16 | #include <asm/i387.h> |
17 | #include <asm/ds.h> | 17 | #include <asm/ds.h> |
18 | #include <asm/debugreg.h> | ||
19 | #include <asm/hw_breakpoint.h> | ||
18 | 20 | ||
19 | unsigned long idle_halt; | 21 | unsigned long idle_halt; |
20 | EXPORT_SYMBOL(idle_halt); | 22 | EXPORT_SYMBOL(idle_halt); |
@@ -46,6 +48,8 @@ void free_thread_xstate(struct task_struct *tsk) | |||
46 | kmem_cache_free(task_xstate_cachep, tsk->thread.xstate); | 48 | kmem_cache_free(task_xstate_cachep, tsk->thread.xstate); |
47 | tsk->thread.xstate = NULL; | 49 | tsk->thread.xstate = NULL; |
48 | } | 50 | } |
51 | if (unlikely(test_tsk_thread_flag(tsk, TIF_DEBUG))) | ||
52 | flush_thread_hw_breakpoint(tsk); | ||
49 | 53 | ||
50 | WARN(tsk->thread.ds_ctx, "leaking DS context\n"); | 54 | WARN(tsk->thread.ds_ctx, "leaking DS context\n"); |
51 | } | 55 | } |
@@ -106,12 +110,8 @@ void flush_thread(void) | |||
106 | 110 | ||
107 | clear_tsk_thread_flag(tsk, TIF_DEBUG); | 111 | clear_tsk_thread_flag(tsk, TIF_DEBUG); |
108 | 112 | ||
109 | tsk->thread.debugreg[0] = 0; | 113 | if (unlikely(test_tsk_thread_flag(tsk, TIF_DEBUG))) |
110 | tsk->thread.debugreg[1] = 0; | 114 | flush_thread_hw_breakpoint(tsk); |
111 | tsk->thread.debugreg[2] = 0; | ||
112 | tsk->thread.debugreg[3] = 0; | ||
113 | tsk->thread.debugreg6 = 0; | ||
114 | tsk->thread.debugreg7 = 0; | ||
115 | memset(tsk->thread.tls_array, 0, sizeof(tsk->thread.tls_array)); | 115 | memset(tsk->thread.tls_array, 0, sizeof(tsk->thread.tls_array)); |
116 | /* | 116 | /* |
117 | * Forget coprocessor state.. | 117 | * Forget coprocessor state.. |
@@ -193,16 +193,6 @@ void __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p, | |||
193 | else if (next->debugctlmsr != prev->debugctlmsr) | 193 | else if (next->debugctlmsr != prev->debugctlmsr) |
194 | update_debugctlmsr(next->debugctlmsr); | 194 | update_debugctlmsr(next->debugctlmsr); |
195 | 195 | ||
196 | if (test_tsk_thread_flag(next_p, TIF_DEBUG)) { | ||
197 | set_debugreg(next->debugreg[0], 0); | ||
198 | set_debugreg(next->debugreg[1], 1); | ||
199 | set_debugreg(next->debugreg[2], 2); | ||
200 | set_debugreg(next->debugreg[3], 3); | ||
201 | /* no 4 and 5 */ | ||
202 | set_debugreg(next->debugreg6, 6); | ||
203 | set_debugreg(next->debugreg7, 7); | ||
204 | } | ||
205 | |||
206 | if (test_tsk_thread_flag(prev_p, TIF_NOTSC) ^ | 196 | if (test_tsk_thread_flag(prev_p, TIF_NOTSC) ^ |
207 | test_tsk_thread_flag(next_p, TIF_NOTSC)) { | 197 | test_tsk_thread_flag(next_p, TIF_NOTSC)) { |
208 | /* prev and next are different */ | 198 | /* prev and next are different */ |