From patchwork Wed Jan 9 18:10:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 210908 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8ED612C024D for ; Thu, 10 Jan 2013 11:37:16 +1100 (EST) Received: from localhost ([::1]:50734 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tt68w-000654-CW for incoming@patchwork.ozlabs.org; Wed, 09 Jan 2013 19:37:14 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35501) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tt68m-00064c-PU for qemu-devel@nongnu.org; Wed, 09 Jan 2013 19:37:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tt68j-00078h-U7 for qemu-devel@nongnu.org; Wed, 09 Jan 2013 19:37:04 -0500 Received: from smtp02.citrix.com ([66.165.176.63]:13857) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tt68j-00078Z-PA; Wed, 09 Jan 2013 19:37:01 -0500 X-IronPort-AV: E=Sophos;i="4.84,440,1355097600"; d="scan'208";a="3078550" Received: from ftlpex01cl01.citrite.net ([10.13.107.78]) by FTLPIPO02.CITRIX.COM with ESMTP/TLS/AES128-SHA; 10 Jan 2013 00:37:00 +0000 Received: from meteora.cam.xci-test.com (10.80.248.22) by smtprelay.citrix.com (10.13.107.78) with Microsoft SMTP Server id 14.2.318.1; Wed, 9 Jan 2013 19:36:59 -0500 From: Julien Grall To: Date: Wed, 9 Jan 2013 18:10:22 +0000 Message-ID: <1357755022-3572-1-git-send-email-julien.grall@citrix.com> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.63 Cc: qemu-trivial@nongnu.org, Julien Grall , aliguori@us.ibm.com Subject: [Qemu-devel] [PATCH] hw/pc.c: Fix converting of ioport_register* to MemoryRegion 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 The commit 258711 introduced MemoryRegion to replace ioport_region* for ioport 80h and F0h. A MemoryRegion needs to have both read and write callback otherwise a segfault will occur when an access is made. The previous behaviour of this both ioport is to return 0xffffffffffffffff. So keep this behaviour. Reported-by: Adam Lackorzynski Signed-off-by: Julien Grall Tested-by: Adam Lackorzynski --- hw/pc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/pc.c b/hw/pc.c index df0c48e..90b1bf7 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -103,6 +103,11 @@ static void ioport80_write(void *opaque, hwaddr addr, uint64_t data, { } +static uint64_t ioport80_read(void *opaque, hwaddr addr, unsigned size) +{ + return 0xffffffffffffffff; +} + /* MSDOS compatibility mode FPU exception support */ static qemu_irq ferr_irq; @@ -123,6 +128,11 @@ static void ioportF0_write(void *opaque, hwaddr addr, uint64_t data, qemu_irq_lower(ferr_irq); } +static uint64_t ioportF0_read(void *opaque, hwaddr addr, unsigned size) +{ + return 0xffffffffffffffff; +} + /* TSC handling */ uint64_t cpu_get_tsc(CPUX86State *env) { @@ -960,6 +970,7 @@ static void cpu_request_exit(void *opaque, int irq, int level) static const MemoryRegionOps ioport80_io_ops = { .write = ioport80_write, + .read = ioport80_read, .endianness = DEVICE_NATIVE_ENDIAN, .impl = { .min_access_size = 1, @@ -969,6 +980,7 @@ static const MemoryRegionOps ioport80_io_ops = { static const MemoryRegionOps ioportF0_io_ops = { .write = ioportF0_write, + .read = ioportF0_read, .endianness = DEVICE_NATIVE_ENDIAN, .impl = { .min_access_size = 1,