mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-11-20 08:38:24 +08:00
KVM: Fix register corruption in pvclock_scale_delta
The 128-bit multiply in pvclock.h was missing an output constraint for EDX which caused a register corruption to appear. Thanks to Ulrich for diagnosing the EDX corruption and Avi for providing this fix. Signed-off-by: Zachary Amsden <zamsden@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
parent
a0a8eaba16
commit
de2d1a524e
@ -22,6 +22,8 @@ static inline u64 pvclock_scale_delta(u64 delta, u32 mul_frac, int shift)
|
|||||||
u64 product;
|
u64 product;
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
u32 tmp1, tmp2;
|
u32 tmp1, tmp2;
|
||||||
|
#else
|
||||||
|
ulong tmp;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (shift < 0)
|
if (shift < 0)
|
||||||
@ -42,8 +44,11 @@ static inline u64 pvclock_scale_delta(u64 delta, u32 mul_frac, int shift)
|
|||||||
: "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) );
|
: "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) );
|
||||||
#elif defined(__x86_64__)
|
#elif defined(__x86_64__)
|
||||||
__asm__ (
|
__asm__ (
|
||||||
"mul %%rdx ; shrd $32,%%rdx,%%rax"
|
"mul %[mul_frac] ; shrd $32, %[hi], %[lo]"
|
||||||
: "=a" (product) : "0" (delta), "d" ((u64)mul_frac) );
|
: [lo]"=a"(product),
|
||||||
|
[hi]"=d"(tmp)
|
||||||
|
: "0"(delta),
|
||||||
|
[mul_frac]"rm"((u64)mul_frac));
|
||||||
#else
|
#else
|
||||||
#error implement me!
|
#error implement me!
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user