]> err.no Git - linux-2.6/commitdiff
[PATCH] xen: x86_64: Add macro for debugreg
authorVincent Hanquez <vincent.hanquez@cl.cam.ac.uk>
Thu, 23 Jun 2005 07:08:46 +0000 (00:08 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 23 Jun 2005 16:45:14 +0000 (09:45 -0700)
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.

Signed-off-by: Vincent Hanquez <vincent.hanquez@cl.cam.ac.uk>
Cc: Ian Pratt <m+Ian.Pratt@cl.cam.ac.uk>
Cc: Andi Kleen <ak@muc.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/x86_64/kernel/signal.c
arch/x86_64/kernel/traps.c
include/asm-x86_64/processor.h

index 3c5f3089371557e612bdb11de518fd02ba3e8acd..0446e8b96a207e050e5ad7b7b9949a7718460010 100644 (file)
@@ -439,7 +439,7 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
                 * inside the kernel.
                 */
                if (current->thread.debugreg7)
-                       asm volatile("movq %0,%%db7"    : : "r" (current->thread.debugreg7));
+                       set_debugreg(current->thread.debugreg7, 7);
 
                /* Whee!  Actually deliver the signal.  */
                return handle_signal(signr, &info, &ka, oldset, regs);
index 3dfec8fdabcdd35799cf014d08fc89d6bf1a7701..21706c1a0f95e035e33c6cd9df7f066e7eb7b447 100644 (file)
@@ -669,7 +669,7 @@ asmlinkage void do_debug(struct pt_regs * regs, unsigned long error_code)
        }
 #endif
 
-       asm("movq %%db6,%0" : "=r" (condition));
+       get_debugreg(condition, 6);
 
        if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code,
                                                SIGTRAP) == NOTIFY_STOP)
@@ -721,7 +721,7 @@ asmlinkage void do_debug(struct pt_regs * regs, unsigned long error_code)
        info.si_addr = (void __user *)regs->rip;
        force_sig_info(SIGTRAP, &info, tsk);    
 clear_dr7:
-       asm volatile("movq %0,%%db7"::"r"(0UL));
+       set_debugreg(0UL, 7);
        return;
 
 clear_TF_reenable:
index 8b55f139968fc3bd730502eb800182ea95ef139d..106f666517bb47eedd3983d8bf72dcdc4fd8d63e 100644 (file)
@@ -280,6 +280,14 @@ struct thread_struct {
        set_fs(USER_DS);                                                         \
 } while(0) 
 
+#define get_debugreg(var, register)                            \
+               __asm__("movq %%db" #register ", %0"            \
+                       :"=r" (var))
+#define set_debugreg(value, register)                  \
+               __asm__("movq %0,%%db" #register                \
+                       : /* no output */                       \
+                       :"r" (value))
+
 struct task_struct;
 struct mm_struct;