From: Avi Kivity Subject: [PATCH] KVM: fix calculation of initial value of rdx register Date: Mon, 06 Nov 2006 13:15:02 -0000 Message-ID: <20061106131502.BD90D2500A7@cleopatra.q> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: akpm-3NddpPZAyC0@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Return-path: To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org 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 for debugging help. Signed-off-by: Avi Kivity 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) ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642