Hi,
The following patch add 2 macros to set and get debugreg on x86_64.
This is useful for Xen because it will need only to redefine each macro
to a hypervisor call.
Please apply, or comments.
Signed-off-by: Vincent Hanquez <[email protected]>
diff -Naur linux-2.6.12-rc3.1/arch/x86_64/kernel/signal.c linux-2.6.12-rc3.2/arch/x86_64/kernel/signal.c
--- linux-2.6.12-rc3.1/arch/x86_64/kernel/signal.c 2005-04-25 14:19:05.000000000 +0100
+++ linux-2.6.12-rc3.2/arch/x86_64/kernel/signal.c 2005-04-25 14:59:09.950079957 +0100
@@ -433,7 +433,7 @@
* inside the kernel.
*/
if (current->thread.debugreg7)
- asm volatile("movq %0,%%db7" : : "r" (current->thread.debugreg7));
+ cpu_set_debugreg(current->thread.debugreg7, 7);
/* Whee! Actually deliver the signal. */
handle_signal(signr, &info, &ka, oldset, regs);
diff -Naur linux-2.6.12-rc3.1/arch/x86_64/kernel/traps.c linux-2.6.12-rc3.2/arch/x86_64/kernel/traps.c
--- linux-2.6.12-rc3.1/arch/x86_64/kernel/traps.c 2005-04-25 12:01:25.000000000 +0100
+++ linux-2.6.12-rc3.2/arch/x86_64/kernel/traps.c 2005-04-25 14:58:17.006385409 +0100
@@ -667,7 +667,7 @@
}
#endif
- asm("movq %%db6,%0" : "=r" (condition));
+ cpu_get_debugreg(condition, 6);
if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code,
SIGTRAP) == NOTIFY_STOP)
@@ -719,7 +719,7 @@
info.si_addr = (void __user *)regs->rip;
force_sig_info(SIGTRAP, &info, tsk);
clear_dr7:
- asm volatile("movq %0,%%db7"::"r"(0UL));
+ cpu_set_debugreg(0UL, 7);
return;
clear_TF_reenable:
diff -Naur linux-2.6.12-rc3.1/include/asm-x86_64/processor.h linux-2.6.12-rc3.2/include/asm-x86_64/processor.h
--- linux-2.6.12-rc3.1/include/asm-x86_64/processor.h 2005-04-25 15:37:51.000000000 +0100
+++ linux-2.6.12-rc3.2/include/asm-x86_64/processor.h 2005-04-25 15:38:13.750221554 +0100
@@ -280,6 +280,14 @@
set_fs(USER_DS); \
} while(0)
+#define cpu_get_debugreg(var, register) \
+ __asm__("movq %%db" #register ", %0" \
+ :"=r" (var))
+#define cpu_set_debugreg(value, register) \
+ __asm__("movq %0,%%db" #register \
+ : /* no output */ \
+ :"r" (value))
+
struct task_struct;
struct mm_struct;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]