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: 124073 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 7C629B6F7F for ; Tue, 8 Nov 2011 00:26:04 +1100 (EST) Received: from localhost ([::1]:38257 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNPD7-0002PZ-Bf for incoming@patchwork.ozlabs.org; Mon, 07 Nov 2011 08:26:01 -0500 Received: from eggs.gnu.org ([140.186.70.92]:48014) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNPCy-0002PT-OA for qemu-devel@nongnu.org; Mon, 07 Nov 2011 08:25:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RNPCu-0002wy-Ib for qemu-devel@nongnu.org; Mon, 07 Nov 2011 08:25:52 -0500 Received: from mnementh.archaic.org.uk ([81.2.115.146]:36102) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNPCu-0002wq-AG for qemu-devel@nongnu.org; Mon, 07 Nov 2011 08:25:48 -0500 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 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 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 81.2.115.146 Cc: patches@linaro.org Subject: [Qemu-devel] [PATCH] hw/omap_gpio: Fix infinite recursion when doing 8/16 bit reads 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 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,