Patchwork [56/60] target-xtensa: fix search_pc for the last TB opcode

login
register
mail settings
Submitter Michael Tokarev
Date Feb. 4, 2013, 10:41 a.m.
Message ID <1359974470-17044-57-git-send-email-mjt@msgid.tls.msk.ru>
Download mbox | patch
Permalink /patch/217920/
State New
Headers show

Comments

Michael Tokarev - Feb. 4, 2013, 10:41 a.m.
From: Max Filippov <jcmvbkbc@gmail.com>

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 <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
(cherry picked from commit 36f25d2537c40c6c47f4abee5d31a24863d1adf7)

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target-xtensa/translate.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Patch

diff --git a/target-xtensa/translate.c b/target-xtensa/translate.c
index 94c51ae..cc82cd9 100644
--- a/target-xtensa/translate.c
+++ b/target-xtensa/translate.c
@@ -2654,7 +2654,11 @@  static void gen_intermediate_code_internal(
     gen_icount_end(tb, insn_count);
     *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;
     }