aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/step.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/step.c')
-rw-r--r--arch/x86/kernel/step.c36
1 files changed, 4 insertions, 32 deletions
diff --git a/arch/x86/kernel/step.c b/arch/x86/kernel/step.c
index 3149032ff107..7beba0769a8c 100644
--- a/arch/x86/kernel/step.c
+++ b/arch/x86/kernel/step.c
@@ -158,22 +158,6 @@ static int enable_single_step(struct task_struct *child)
158} 158}
159 159
160/* 160/*
161 * Install this value in MSR_IA32_DEBUGCTLMSR whenever child is running.
162 */
163static void write_debugctlmsr(struct task_struct *child, unsigned long val)
164{
165 if (child->thread.debugctlmsr == val)
166 return;
167
168 child->thread.debugctlmsr = val;
169
170 if (child != current)
171 return;
172
173 update_debugctlmsr(val);
174}
175
176/*
177 * Enable single or block step. 161 * Enable single or block step.
178 */ 162 */
179static void enable_step(struct task_struct *child, bool block) 163static void enable_step(struct task_struct *child, bool block)
@@ -185,17 +169,9 @@ static void enable_step(struct task_struct *child, bool block)
185 * So noone should try to use debugger block stepping in a program 169 * So noone should try to use debugger block stepping in a program
186 * that uses user-mode single stepping itself. 170 * that uses user-mode single stepping itself.
187 */ 171 */
188 if (enable_single_step(child) && block) { 172 if (!enable_single_step(child))
189 set_tsk_thread_flag(child, TIF_DEBUGCTLMSR); 173 return;
190 write_debugctlmsr(child, 174 /* XXX */
191 child->thread.debugctlmsr | DEBUGCTLMSR_BTF);
192 } else {
193 write_debugctlmsr(child,
194 child->thread.debugctlmsr & ~DEBUGCTLMSR_BTF);
195
196 if (!child->thread.debugctlmsr)
197 clear_tsk_thread_flag(child, TIF_DEBUGCTLMSR);
198 }
199} 175}
200 176
201void user_enable_single_step(struct task_struct *child) 177void user_enable_single_step(struct task_struct *child)
@@ -213,11 +189,7 @@ void user_disable_single_step(struct task_struct *child)
213 /* 189 /*
214 * Make sure block stepping (BTF) is disabled. 190 * Make sure block stepping (BTF) is disabled.
215 */ 191 */
216 write_debugctlmsr(child, 192 /* XXX */
217 child->thread.debugctlmsr & ~DEBUGCTLMSR_BTF);
218
219 if (!child->thread.debugctlmsr)
220 clear_tsk_thread_flag(child, TIF_DEBUGCTLMSR);
221 193
222 /* Always clear TIF_SINGLESTEP... */ 194 /* Always clear TIF_SINGLESTEP... */
223 clear_tsk_thread_flag(child, TIF_SINGLESTEP); 195 clear_tsk_thread_flag(child, TIF_SINGLESTEP);