diff options
author | Vincent Hanquez <vincent.hanquez@cl.cam.ac.uk> | 2005-06-23 03:08:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-23 12:45:14 -0400 |
commit | e9129e56e9ec50c0689eb4cf7a3ca132f1e776db (patch) | |
tree | 46ef37651b1d25afbe002e00d8c80c85df27d5fd | |
parent | 717b594a415bfaf2dbd5e8266636488f2564c689 (diff) |
[PATCH] xen: x86_64: Add macro for debugreg
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>
-rw-r--r-- | arch/x86_64/kernel/signal.c | 2 | ||||
-rw-r--r-- | arch/x86_64/kernel/traps.c | 4 | ||||
-rw-r--r-- | include/asm-x86_64/processor.h | 8 |
3 files changed, 11 insertions, 3 deletions
diff --git a/arch/x86_64/kernel/signal.c b/arch/x86_64/kernel/signal.c index 3c5f30893715..0446e8b96a20 100644 --- a/arch/x86_64/kernel/signal.c +++ b/arch/x86_64/kernel/signal.c | |||
@@ -439,7 +439,7 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset) | |||
439 | * inside the kernel. | 439 | * inside the kernel. |
440 | */ | 440 | */ |
441 | if (current->thread.debugreg7) | 441 | if (current->thread.debugreg7) |
442 | asm volatile("movq %0,%%db7" : : "r" (current->thread.debugreg7)); | 442 | set_debugreg(current->thread.debugreg7, 7); |
443 | 443 | ||
444 | /* Whee! Actually deliver the signal. */ | 444 | /* Whee! Actually deliver the signal. */ |
445 | return handle_signal(signr, &info, &ka, oldset, regs); | 445 | return handle_signal(signr, &info, &ka, oldset, regs); |
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c index 3dfec8fdabcd..21706c1a0f95 100644 --- a/arch/x86_64/kernel/traps.c +++ b/arch/x86_64/kernel/traps.c | |||
@@ -669,7 +669,7 @@ asmlinkage void do_debug(struct pt_regs * regs, unsigned long error_code) | |||
669 | } | 669 | } |
670 | #endif | 670 | #endif |
671 | 671 | ||
672 | asm("movq %%db6,%0" : "=r" (condition)); | 672 | get_debugreg(condition, 6); |
673 | 673 | ||
674 | if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code, | 674 | if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code, |
675 | SIGTRAP) == NOTIFY_STOP) | 675 | SIGTRAP) == NOTIFY_STOP) |
@@ -721,7 +721,7 @@ asmlinkage void do_debug(struct pt_regs * regs, unsigned long error_code) | |||
721 | info.si_addr = (void __user *)regs->rip; | 721 | info.si_addr = (void __user *)regs->rip; |
722 | force_sig_info(SIGTRAP, &info, tsk); | 722 | force_sig_info(SIGTRAP, &info, tsk); |
723 | clear_dr7: | 723 | clear_dr7: |
724 | asm volatile("movq %0,%%db7"::"r"(0UL)); | 724 | set_debugreg(0UL, 7); |
725 | return; | 725 | return; |
726 | 726 | ||
727 | clear_TF_reenable: | 727 | clear_TF_reenable: |
diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h index 8b55f139968f..106f666517bb 100644 --- a/include/asm-x86_64/processor.h +++ b/include/asm-x86_64/processor.h | |||
@@ -280,6 +280,14 @@ struct thread_struct { | |||
280 | set_fs(USER_DS); \ | 280 | set_fs(USER_DS); \ |
281 | } while(0) | 281 | } while(0) |
282 | 282 | ||
283 | #define get_debugreg(var, register) \ | ||
284 | __asm__("movq %%db" #register ", %0" \ | ||
285 | :"=r" (var)) | ||
286 | #define set_debugreg(value, register) \ | ||
287 | __asm__("movq %0,%%db" #register \ | ||
288 | : /* no output */ \ | ||
289 | :"r" (value)) | ||
290 | |||
283 | struct task_struct; | 291 | struct task_struct; |
284 | struct mm_struct; | 292 | struct mm_struct; |
285 | 293 | ||