From patchwork Mon Oct 10 14:59:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 118781 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0F4F8B70FE for ; Tue, 11 Oct 2011 03:35:28 +1100 (EST) Received: from localhost ([::1]:33926 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDHLh-0006mt-PX for incoming@patchwork.ozlabs.org; Mon, 10 Oct 2011 11:01:01 -0400 Received: from eggs.gnu.org ([140.186.70.92]:37693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDHL7-0005Ys-1P for qemu-devel@nongnu.org; Mon, 10 Oct 2011 11:00:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RDHL3-00028p-3i for qemu-devel@nongnu.org; Mon, 10 Oct 2011 11:00:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17949) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDHL2-000280-Hx for qemu-devel@nongnu.org; Mon, 10 Oct 2011 11:00:20 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9AF0II3030388 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 10 Oct 2011 11:00:18 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p9AF0HFm009980; Mon, 10 Oct 2011 11:00:18 -0400 Received: from s01.tlv.redhat.com (s01.tlv.redhat.com [10.35.255.8]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id 53EBBB06BE; Mon, 10 Oct 2011 17:00:01 +0200 (IST) From: Avi Kivity To: Anthony Liguori , qemu-devel@nongnu.org Date: Mon, 10 Oct 2011 16:59:40 +0200 Message-Id: <1318258793-10576-12-git-send-email-avi@redhat.com> In-Reply-To: <1318258793-10576-1-git-send-email-avi@redhat.com> References: <1318258793-10576-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 11/24] memory: Fix old portio word accesses X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jan Kiszka As we register old portio regions via ioport_register, we are also responsible for providing the word access wrapper. Signed-off-by: Jan Kiszka Signed-off-by: Avi Kivity --- memory.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/memory.c b/memory.c index 27abd3e..dc5e35d 100644 --- a/memory.c +++ b/memory.c @@ -404,6 +404,11 @@ static void memory_region_iorange_read(IORange *iorange, *data = ((uint64_t)1 << (width * 8)) - 1; if (mrp) { *data = mrp->read(mr->opaque, offset + mr->offset); + } else if (width == 2) { + mrp = find_portio(mr, offset, 1, false); + assert(mrp); + *data = mrp->read(mr->opaque, offset + mr->offset) | + (mrp->read(mr->opaque, offset + mr->offset + 1) << 8); } return; } @@ -426,6 +431,11 @@ static void memory_region_iorange_write(IORange *iorange, if (mrp) { mrp->write(mr->opaque, offset + mr->offset, data); + } else if (width == 2) { + mrp = find_portio(mr, offset, 1, false); + assert(mrp); + mrp->write(mr->opaque, offset + mr->offset, data & 0xff); + mrp->write(mr->opaque, offset + mr->offset + 1, data >> 8); } return; }