From patchwork Mon Mar 16 16:54:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Alrae X-Patchwork-Id: 450667 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8DFDC1400B6 for ; Tue, 17 Mar 2015 03:55:17 +1100 (AEDT) Received: from localhost ([::1]:50634 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXYIN-0002Dj-TC for incoming@patchwork.ozlabs.org; Mon, 16 Mar 2015 12:55:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXYI7-0001sf-FU for qemu-devel@nongnu.org; Mon, 16 Mar 2015 12:55:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YXYI3-0000rf-Dh for qemu-devel@nongnu.org; Mon, 16 Mar 2015 12:54:59 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:48091) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXYI3-0000rW-5h for qemu-devel@nongnu.org; Mon, 16 Mar 2015 12:54:55 -0400 Received: from KLMAIL01.kl.imgtec.org (unknown [192.168.5.35]) by Websense Email Security Gateway with ESMTPS id 4DE52E10A83E2; Mon, 16 Mar 2015 16:54:50 +0000 (GMT) Received: from lalrae-linux.kl.imgtec.org (192.168.14.163) by KLMAIL01.kl.imgtec.org (192.168.5.35) with Microsoft SMTP Server (TLS) id 14.3.195.1; Mon, 16 Mar 2015 16:54:53 +0000 From: Leon Alrae To: Date: Mon, 16 Mar 2015 16:54:42 +0000 Message-ID: <1426524882-19151-1-git-send-email-leon.alrae@imgtec.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-Originating-IP: [192.168.14.163] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.59.15.196 Cc: macro@linux-mips.org, aurelien@aurel32.net Subject: [Qemu-devel] [PATCH v2] target-mips: fix CP0.BadVAddr by stopping translation on Address Error 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 CP0.BadVAddr is supposed to capture the most recent virtual address that caused the exception. Currently this does not work correctly for unaligned instruction fetch as translation is not stopped and CP0.BadVAddr is updated with subsequent addresses. Signed-off-by: Leon Alrae --- v2: * description update - make it clear that it is about instr. fetch (Maciej) --- target-mips/translate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target-mips/translate.c b/target-mips/translate.c index 9059bfd..0e2443a 100644 --- a/target-mips/translate.c +++ b/target-mips/translate.c @@ -18438,6 +18438,7 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx) if (ctx->pc & 0x3) { env->CP0_BadVAddr = ctx->pc; generate_exception_err(ctx, EXCP_AdEL, EXCP_INST_NOTAVAIL); + ctx->bstate = BS_STOP; return; }