From: Avi Kivity Subject: [PATCH] KVM: Fix emulator mov cr decoding Date: Mon, 20 Nov 2006 10:29:39 -0000 Message-ID: <20061120102939.C032125015E@cleopatra.q> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: akpm-3NddpPZAyC0@public.gmane.org, kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, yaniv.kamay-atKUWr5tajBWk0Htik3J/w@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 From: Yaniv Kamay Decoding of the mov cr instructions was wrong. Signed-off-by: Yaniv Kamay Signed-off-by: Avi Kivity Index: linux-2.6/drivers/kvm/x86_emulate.c =================================================================== --- linux-2.6.orig/drivers/kvm/x86_emulate.c +++ linux-2.6/drivers/kvm/x86_emulate.c @@ -1268,13 +1268,13 @@ twobyte_special_insn: b = insn_fetch(u8, 1, _eip); if ((b & 0xc0) != 0xc0) goto cannot_emulate; - _regs[(b >> 3) & 7] = realmode_get_cr(ctxt->vcpu, b & 7); + _regs[b & 7] = realmode_get_cr(ctxt->vcpu, (b >> 3) & 7); break; case 0x22: /* mov reg, cr */ b = insn_fetch(u8, 1, _eip); if ((b & 0xc0) != 0xc0) goto cannot_emulate; - realmode_set_cr(ctxt->vcpu, b & 7, _regs[(b >> 3) & 7] & -1u, + realmode_set_cr(ctxt->vcpu, (b >> 3) & 7, _regs[b & 7] & -1u, &_eflags); break; case 0xc7: /* Grp9 (cmpxchg8b) */ ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV