lkml.org 
[lkml]   [2006]   [Nov]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] KVM: fix calculation of initial value of rdx register
From
Date
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)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2006-11-06 14:17    [W:0.033 / U:1.848 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site