x86_handle_debug_exception(): The values of dr6 and dr7 are only stored in

the CPU info, if x86_exit_user_debug_at_kernel_entry() was executed before,
i.e. if the debug exception occurred in userlands. In all other cases we need
to read the current register values. Fixes #5742, a regression introduced in
r35951.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36340 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2010-04-18 17:06:02 +00:00
parent d546a6fb9c
commit 45538a5e31

View File

@ -835,11 +835,22 @@ x86_exit_user_debug_at_kernel_entry()
void
x86_handle_debug_exception(struct iframe *frame)
{
// get debug status and control registers (saved earlier in
// x86_exit_user_debug_at_kernel_entry())
struct thread* thread = thread_get_current_thread();
uint32 dr6 = thread->cpu->arch.dr6;
uint32 dr7 = thread->cpu->arch.dr7;
// Get dr6 and dr7. If the given iframe is a userland frame, the exception
// obviously occurred in userland. In that case
// x86_exit_user_debug_at_kernel_entry() has already been invoked and dr6
// and dr7 are stored in the cpu info. Otherwise we need to fetch the
// current values from the registers.
uint32 dr6;
uint32 dr7;
if (IFRAME_IS_USER(frame)) {
dr6 = thread->cpu->arch.dr6;
dr7 = thread->cpu->arch.dr7;
} else {
asm("movl %%dr6, %0" : "=r"(dr6));
asm("movl %%dr7, %0" : "=r"(dr7));
}
TRACE(("i386_handle_debug_exception(): DR6: %lx, DR7: %lx\n", dr6, dr7));