From patchwork Thu May 30 14:35:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 2636941 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 277B4DF2A1 for ; Thu, 30 May 2013 14:36:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932731Ab3E3OgL (ORCPT ); Thu, 30 May 2013 10:36:11 -0400 Received: from mail-ea0-f172.google.com ([209.85.215.172]:47467 "EHLO mail-ea0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932445Ab3E3OgJ (ORCPT ); Thu, 30 May 2013 10:36:09 -0400 Received: by mail-ea0-f172.google.com with SMTP id d10so423183eaj.3 for ; Thu, 30 May 2013 07:36:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer; bh=nuG9xSC66MPOOvdQ/to4jIKRYax+y0qTFxv1PC1eFcY=; b=OSGtzKR8RLdswuwdNWEMy2Q7etcUtHpJgKL7zqsVWKd6xuCF4oFN+kMzQShkelvsL4 R19KSjlzMZRBrFPDS0t73+xxWQAuw+3NfoSoBkJypksTfVOkDJnM9iO9iZM4b3llBaSO EgGJeTuDn+7satAQrH3lDDiqH1JzHXp0nLxDo3lR6JrqQd/WMegmcTRzTTgG0uHq79i8 N7/DoPApuWf0uJOq+EDhkv5PEqIpN6ggDypxoLboRxyzNUJUDEs5e1UG7pVQzJGjJWj8 f2746mqlEXkyKGz/O4MD3GX4cTvu9P1j53GOoZVAaFpttzkm4v53YZPU7rzlveCcD8hi atTw== X-Received: by 10.14.94.3 with SMTP id m3mr9926587eef.66.1369924567921; Thu, 30 May 2013 07:36:07 -0700 (PDT) Received: from playground.lan (net-37-116-217-184.cust.dsl.vodafone.it. [37.116.217.184]) by mx.google.com with ESMTPSA id m48sm61064973eeh.16.2013.05.30.07.36.05 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 30 May 2013 07:36:06 -0700 (PDT) From: Paolo Bonzini To: linux-kernel@vger.kernel.org Cc: gnatapov@redhat.com, kvm@vger.kernel.org, Subject: [PATCH] KVM: fix sil/dil/bpl/spl in the mod/rm fields Date: Thu, 30 May 2013 16:35:55 +0200 Message-Id: <1369924555-30216-1-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.1.4 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The x86-64 extended low-byte registers were fetched correctly from reg, but not from mod/rm. This fixes another bug in the boot of RHEL5.9 64-bit, but it is still not enough. Cc: gnatapov@redhat.com Cc: kvm@vger.kernel.org Cc: # 3.9 Signed-off-by: Paolo Bonzini --- arch/x86/kvm/emulate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index aa68106..028b34f 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -1239,9 +1239,12 @@ static int decode_modrm(struct x86_emulate_ctxt *ctxt, ctxt->modrm_seg = VCPU_SREG_DS; if (ctxt->modrm_mod == 3) { + int highbyte_regs = ctxt->rex_prefix == 0; + op->type = OP_REG; op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes; - op->addr.reg = decode_register(ctxt, ctxt->modrm_rm, ctxt->d & ByteOp); + op->addr.reg = decode_register(ctxt, ctxt->modrm_rm, + highbyte_regs && (ctxt->d & ByteOp)); if (ctxt->d & Sse) { op->type = OP_XMM; op->bytes = 16;