From patchwork Sat Feb 6 16:43:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 44706 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 AD627B7D2C for ; Sun, 7 Feb 2010 03:47:30 +1100 (EST) Received: from localhost ([127.0.0.1]:53485 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ndnod-0007b3-Sp for incoming@patchwork.ozlabs.org; Sat, 06 Feb 2010 11:47:27 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ndnlc-00070H-PQ for qemu-devel@nongnu.org; Sat, 06 Feb 2010 11:44:20 -0500 Received: from [199.232.76.173] (port=59316 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ndnlb-0006zy-Uo for qemu-devel@nongnu.org; Sat, 06 Feb 2010 11:44:19 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NdnlX-00055W-8j for qemu-devel@nongnu.org; Sat, 06 Feb 2010 11:44:18 -0500 Received: from mx20.gnu.org ([199.232.41.8]:39491) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NdnlU-000510-Uh for qemu-devel@nongnu.org; Sat, 06 Feb 2010 11:44:15 -0500 Received: from hall.aurel32.net ([88.191.82.174]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NdnlC-0005k7-72 for qemu-devel@nongnu.org; Sat, 06 Feb 2010 11:43:54 -0500 Received: from [2002:52e8:2fb:1:21e:8cff:feb0:693b] (helo=volta.aurel32.net) by hall.aurel32.net with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1NdnlB-0007r6-Kt; Sat, 06 Feb 2010 17:43:53 +0100 Received: from aurel32 by volta.aurel32.net with local (Exim 4.71) (envelope-from ) id 1NdnlA-00065b-GL; Sat, 06 Feb 2010 17:43:52 +0100 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Sat, 6 Feb 2010 17:43:37 +0100 Message-Id: <1265474623-23367-3-git-send-email-aurelien@aurel32.net> X-Mailer: git-send-email 1.6.6.1 In-Reply-To: <1265474623-23367-1-git-send-email-aurelien@aurel32.net> References: <1265474623-23367-1-git-send-email-aurelien@aurel32.net> X-detected-operating-system: by mx20.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Aurelien Jarno Subject: [Qemu-devel] [PATCH 2/8] target-sh4: MMU: fix mem_idx computation 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 The mem_idx is wrongly computed. As written in target-sh4/cpu.h, mode 0 corresponds to kernel mode (SR_MD = 1), while mode 1 corresponds to user mode (SR_MD = 0). Signed-off-by: Aurelien Jarno --- target-sh4/translate.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/target-sh4/translate.c b/target-sh4/translate.c index 8f0a986..bff3188 100644 --- a/target-sh4/translate.c +++ b/target-sh4/translate.c @@ -1905,7 +1905,7 @@ gen_intermediate_code_internal(CPUState * env, TranslationBlock * tb, ctx.bstate = BS_NONE; ctx.sr = env->sr; ctx.fpscr = env->fpscr; - ctx.memidx = (env->sr & SR_MD) ? 1 : 0; + ctx.memidx = (env->sr & SR_MD) == 0 ? 1 : 0; /* We don't know if the delayed pc came from a dynamic or static branch, so assume it is a dynamic branch. */ ctx.delayed_pc = -1; /* use delayed pc from env pointer */