From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:59032) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RL0Aw-0006tm-N4 for qemu-devel@nongnu.org; Mon, 31 Oct 2011 18:17:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RL0Au-0004xo-SE for qemu-devel@nongnu.org; Mon, 31 Oct 2011 18:17:50 -0400 Received: from [188.134.19.124] (port=52719 helo=octofox.metropolis) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RL0Au-0004wU-Ix for qemu-devel@nongnu.org; Mon, 31 Oct 2011 18:17:48 -0400 From: Max Filippov Date: Tue, 1 Nov 2011 02:17:30 +0400 Message-Id: <1320099455-17326-6-git-send-email-jcmvbkbc@gmail.com> In-Reply-To: <1320099455-17326-1-git-send-email-jcmvbkbc@gmail.com> References: <1320099455-17326-1-git-send-email-jcmvbkbc@gmail.com> Subject: [Qemu-devel] [PATCH 3/7] target-xtensa: raise an exception for invalid and reserved opcodes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Blue Swirl , jcmvbkbc@gmail.com, qemu-devel@nongnu.org This includes opcodes from disabled features and those marked reserved in the ISA. Also end TB on opcodes that definitely generate an exception: illegal instructions, syscall and privileged instructions. Signed-off-by: Max Filippov --- target-xtensa/translate.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/target-xtensa/translate.c b/target-xtensa/translate.c index b724d46..c81450d 100644 --- a/target-xtensa/translate.c +++ b/target-xtensa/translate.c @@ -266,6 +266,10 @@ static void gen_exception_cause(DisasContext *dc, uint32_t cause) gen_helper_exception_cause(tpc, tcause); tcg_temp_free(tpc); tcg_temp_free(tcause); + if (cause == ILLEGAL_INSTRUCTION_CAUSE || + cause == SYSCALL_CAUSE) { + dc->is_jmp = DISAS_UPDATE; + } } static void gen_exception_cause_vaddr(DisasContext *dc, uint32_t cause, @@ -283,6 +287,7 @@ static void gen_check_privilege(DisasContext *dc) { if (dc->cring) { gen_exception_cause(dc, PRIVILEGED_CAUSE); + dc->is_jmp = DISAS_UPDATE; } } @@ -2378,7 +2383,7 @@ static void disas_xtensa_insn(DisasContext *dc) invalid_opcode: qemu_log("INVALID(pc = %08x)\n", dc->pc); - dc->pc = dc->next_pc; + gen_exception_cause(dc, ILLEGAL_INSTRUCTION_CAUSE); #undef HAS_OPTION } -- 1.7.6.4