1 From: Zachary Amsden <zamsden@redhat.com>
2 Date: Thu, 16 Jun 2011 03:50:04 +0000 (-0700)
3 Subject: KVM: Fix register corruption in pvclock_scale_delta
4 X-Git-Url: http://git.kernel.org/?p=virt%2Fkvm%2Fkvm.git;a=commitdiff_plain;h=eaa6a665a3c0fb5f8dbf25bca02eae5594095f4f
6 KVM: Fix register corruption in pvclock_scale_delta
8 The 128-bit multiply in pvclock.h was missing an output constraint for
9 EDX which caused a register corruption to appear. Thanks to Ulrich for
10 diagnosing the EDX corruption and Avi for providing this fix.
12 Signed-off-by: Zachary Amsden <zamsden@redhat.com>
13 Signed-off-by: Avi Kivity <avi@redhat.com>
16 diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h
17 index 31d84ac..a518c0a 100644
18 --- a/arch/x86/include/asm/pvclock.h
19 +++ b/arch/x86/include/asm/pvclock.h
20 @@ -22,6 +22,8 @@ static inline u64 pvclock_scale_delta(u64 delta, u32 mul_frac, int shift)
29 @@ -42,8 +44,11 @@ static inline u64 pvclock_scale_delta(u64 delta, u32 mul_frac, int shift)
30 : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) );
31 #elif defined(__x86_64__)
33 - "mul %%rdx ; shrd $32,%%rdx,%%rax"
34 - : "=a" (product) : "0" (delta), "d" ((u64)mul_frac) );
35 + "mul %[mul_frac] ; shrd $32, %[hi], %[lo]"
36 + : [lo]"=a"(product),
39 + [mul_frac]"rm"((u64)mul_frac));