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 From: Aurelien Jarno Date: Sat, 6 Feb 2010 17:43:37 +0100 Message-Id: <1265474623-23367-3-git-send-email-aurelien@aurel32.net> In-Reply-To: <1265474623-23367-1-git-send-email-aurelien@aurel32.net> References: <1265474623-23367-1-git-send-email-aurelien@aurel32.net> Subject: [Qemu-devel] [PATCH 2/8] target-sh4: MMU: fix mem_idx computation List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Aurelien Jarno 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 */ -- 1.6.6.1