From 36f25d2537c40c6c47f4abee5d31a24863d1adf7 Mon Sep 17 00:00:00 2001 From: Max Filippov Date: Thu, 20 Dec 2012 00:04:09 +0400 Subject: [PATCH] target-xtensa: fix search_pc for the last TB opcode Zero out tcg_ctx.gen_opc_instr_start for instructions representing the last guest opcode in the TB. Cc: qemu-stable@nongnu.org Signed-off-by: Max Filippov Signed-off-by: Blue Swirl --- target-xtensa/translate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/target-xtensa/translate.c b/target-xtensa/translate.c index 0a037291ef..7029ac4814 100644 --- a/target-xtensa/translate.c +++ b/target-xtensa/translate.c @@ -3005,7 +3005,11 @@ static void gen_intermediate_code_internal( gen_icount_end(tb, insn_count); *tcg_ctx.gen_opc_ptr = INDEX_op_end; - if (!search_pc) { + if (search_pc) { + j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; + memset(tcg_ctx.gen_opc_instr_start + lj + 1, 0, + (j - lj) * sizeof(tcg_ctx.gen_opc_instr_start[0])); + } else { tb->size = dc.pc - pc_start; tb->icount = insn_count; }