From patchwork Mon Nov 7 13:25:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 4946 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 2D28B23E04 for ; Mon, 7 Nov 2011 13:25:56 +0000 (UTC) Received: from mail-bw0-f52.google.com (mail-bw0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id 11F16A185F1 for ; Mon, 7 Nov 2011 13:25:56 +0000 (UTC) Received: by bkbc12 with SMTP id c12so5580824bkb.11 for ; Mon, 07 Nov 2011 05:25:55 -0800 (PST) Received: by 10.152.104.206 with SMTP id gg14mr6502975lab.41.1320672355683; Mon, 07 Nov 2011 05:25:55 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.14.103 with SMTP id o7cs56684lac; Mon, 7 Nov 2011 05:25:53 -0800 (PST) Received: by 10.216.176.14 with SMTP id a14mr3589883wem.14.1320672349770; Mon, 07 Nov 2011 05:25:49 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id f17si12281296wed.28.2011.11.07.05.25.47 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 07 Nov 2011 05:25:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1RNPCr-0001Vb-AR; Mon, 07 Nov 2011 13:25:45 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Andrzej Zaborowski Subject: [PATCH] hw/omap_gpio: Fix infinite recursion when doing 8/16 bit reads Date: Mon, 7 Nov 2011 13:25:45 +0000 Message-Id: <1320672345-5776-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 Fix a long-standing bug which meant that any attempt to do an 8 or 16 bit read from the OMAP GPIO module would cause qemu to crash due to an infinite recursion. Signed-off-by: Peter Maydell --- This has actually been in the code since the original OMAP2 support was added in 2008; we've never noticed before because the kernel happened to always do 32 bit accesses... Long term we should fix this by conversion to MemoryRegion; this is the minimally invasive fix for 1.0. hw/omap_gpio.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/omap_gpio.c b/hw/omap_gpio.c index d775df6..d630748 100644 --- a/hw/omap_gpio.c +++ b/hw/omap_gpio.c @@ -510,7 +510,7 @@ static void omap2_gpio_module_write(void *opaque, target_phys_addr_t addr, static uint32_t omap2_gpio_module_readp(void *opaque, target_phys_addr_t addr) { - return omap2_gpio_module_readp(opaque, addr) >> ((addr & 3) << 3); + return omap2_gpio_module_read(opaque, addr & ~3) >> ((addr & 3) << 3); } static void omap2_gpio_module_writep(void *opaque, target_phys_addr_t addr,