Patchwork [v2] target-xtensa: fix search_pc for the last TB opcode

login
register
mail settings
Submitter Max Filippov
Date Dec. 19, 2012, 8:04 p.m.
Message ID <1355947449-22308-1-git-send-email-jcmvbkbc@gmail.com>
Download mbox | patch
Permalink /patch/207512/
State New
Headers show

Comments

Max Filippov - Dec. 19, 2012, 8:04 p.m.
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>
---
Changes v1 -> v2:
- replace while loop with memset

 target-xtensa/translate.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
Blue Swirl - Dec. 22, 2012, 3:41 p.m.
Thanks, applied.

On Wed, Dec 19, 2012 at 8:04 PM, Max Filippov <jcmvbkbc@gmail.com> wrote:
> 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>
> ---
> Changes v1 -> v2:
> - replace while loop with memset
>
>  target-xtensa/translate.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/target-xtensa/translate.c b/target-xtensa/translate.c
> index 5d8762c..2931d00 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;
>      }
> --
> 1.7.7.6
>

Patch

diff --git a/target-xtensa/translate.c b/target-xtensa/translate.c
index 5d8762c..2931d00 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;
     }