From patchwork Mon Jan 24 09:02:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 80120 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DAD38B711E for ; Mon, 24 Jan 2011 20:45:24 +1100 (EST) Received: from localhost ([127.0.0.1]:38340 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PhIzB-0006mq-RA for incoming@patchwork.ozlabs.org; Mon, 24 Jan 2011 04:45:22 -0500 Received: from [140.186.70.92] (port=38023 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PhIMU-0008NO-DR for qemu-devel@nongnu.org; Mon, 24 Jan 2011 04:05:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PhIMP-0007FC-M5 for qemu-devel@nongnu.org; Mon, 24 Jan 2011 04:05:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48169) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PhIMP-0007EG-FP for qemu-devel@nongnu.org; Mon, 24 Jan 2011 04:05:17 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0O95GrY001172 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 24 Jan 2011 04:05:16 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p0O95GXC014268; Mon, 24 Jan 2011 04:05:16 -0500 Received: from amt.cnet (vpn2-9-29.ams2.redhat.com [10.36.9.29]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p0O95EBA008948; Mon, 24 Jan 2011 04:05:15 -0500 Received: from amt.cnet (localhost.localdomain [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 9565265214C; Mon, 24 Jan 2011 07:03:40 -0200 (BRST) Received: (from marcelo@localhost) by amt.cnet (8.14.4/8.14.4/Submit) id p0O93arO028395; Mon, 24 Jan 2011 07:03:36 -0200 From: Marcelo Tosatti To: Anthony Liguori Date: Mon, 24 Jan 2011 07:02:18 -0200 Message-Id: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Jan Kiszka , qemu-devel@nongnu.org, kvm@vger.kernel.org, Avi Kivity Subject: [Qemu-devel] [PATCH 09/31] kvm: x86: Fix DPL write back of segment registers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jan Kiszka The DPL is stored in the flags and not in the selector. In fact, the RPL may differ from the DPL at some point in time, and so we were corrupting the guest state so far. Signed-off-by: Jan Kiszka Signed-off-by: Avi Kivity --- target-i386/kvm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 9a4bf98..ee7bdf8 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -602,7 +602,7 @@ static void set_seg(struct kvm_segment *lhs, const SegmentCache *rhs) lhs->limit = rhs->limit; lhs->type = (flags >> DESC_TYPE_SHIFT) & 15; lhs->present = (flags & DESC_P_MASK) != 0; - lhs->dpl = rhs->selector & 3; + lhs->dpl = (flags >> DESC_DPL_SHIFT) & 3; lhs->db = (flags >> DESC_B_SHIFT) & 1; lhs->s = (flags & DESC_S_MASK) != 0; lhs->l = (flags >> DESC_L_SHIFT) & 1;