Skip to contentSkip to conversation

KVM: Fix unsigned asm instruction in kvm_write_tsc()

PATCH Applied Avi Kivity 2 participants 2 messages Mar 8, 2012

Subsystems (3)
lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

PATCH 1/1 KVM: Fix unsigned asm instruction in kvm_write_tsc()

'idiv', when given a memory operand, can't determine the instruction size. Provide it explicitly.

---
 arch/x86/kvm/x86.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kvm/x86.c +1 -1
index 7ce5878..32096cf 100644
@@ -1038,7 +1038,7 @@ void kvm_write_tsc(struct kvm_vcpu *vcpu, u64 data)
 	nsdiff = (nsdiff * 1000) / vcpu->arch.virtual_tsc_khz;
 #else
 	/* do_div() only does unsigned */
-	asm("idiv %2; xor %%edx, %%edx"
+	asm("idivl %2; xor %%edx, %%edx"
 	    : "=A"(nsdiff)
 	    : "A"(nsdiff * 1000), "rm"(vcpu->arch.virtual_tsc_khz));
 #endif
Signature · 1 line
1.7.9