mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] KVM: fix calculation of initial value of rdx register
@ 2006-11-06 13:15 Avi Kivity
  0 siblings, 0 replies; only message in thread
From: Avi Kivity @ 2006-11-06 13:15 UTC (permalink / raw)
  To: kvm-devel; +Cc: Christian Hesse, linux-kernel, akpm

On bootup, the rdx register contains information about the processor.  The
function which calculates this value has the bugs:

 - missing 'cpuid' to get the value from the processor
 - missing register clobber caused a miscompilation in some circumstances
 - we shouldn't return a value that depends on the current processor in 
   case we migrate

In any case nobody looks at the value, so just return a generic P6
identifier.

Thanks to Christian Hesse <mail@earthworm.de> for debugging help.

Signed-off-by: Avi Kivity <avi@qumranet.com>

Index: linux-2.6/drivers/kvm/kvm_main.c
===================================================================
--- linux-2.6.orig/drivers/kvm/kvm_main.c
+++ linux-2.6/drivers/kvm/kvm_main.c
@@ -1052,12 +1052,7 @@ static void set_cr8(struct kvm_vcpu *vcp
 
 static u32 get_rdx_init_val(void)
 {
-	u32 val;
-
-	asm ("movl $1, %%eax \n\t"
-	     "movl %%eax, %0 \n\t" : "=g"(val) );
-	return val;
-
+	return 0x600; /* P6 family */
 }
 
 static void fx_init(struct kvm_vcpu *vcpu)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-11-06 13:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-06 13:15 [PATCH] KVM: fix calculation of initial value of rdx register Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®