[v14,07/34] target/arm: Set is_jmp properly after single-stepping
diff mbox

Message ID 20170715094243.28371-8-rth@twiddle.net
State New
Headers show

Commit Message

Richard Henderson July 15, 2017, 9:42 a.m. UTC
We have generated an exception, so use DISAS_NORETURN.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 target/arm/translate-a64.c | 1 +
 target/arm/translate.c     | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Emilio G. Cota July 21, 2017, 9:37 p.m. UTC | #1
On Fri, Jul 14, 2017 at 23:42:16 -1000, Richard Henderson wrote:
> We have generated an exception, so use DISAS_NORETURN.
> 
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>  target/arm/translate-a64.c | 1 +
>  target/arm/translate.c     | 4 +++-
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
> index 342ff7c..657684b 100644
> --- a/target/arm/translate-a64.c
> +++ b/target/arm/translate-a64.c
> @@ -11285,6 +11285,7 @@ void gen_intermediate_code_a64(CPUState *cs, TranslationBlock *tb)
>                          dc->is_jmp = DISAS_UPDATE;
>                      } else {
>                          gen_exception_internal_insn(dc, 0, EXCP_DEBUG);
> +                        dc->is_jmp = DISAS_NORETURN;
>                          /* The address covered by the breakpoint must be
>                             included in [tb->pc, tb->pc + tb->size) in order
>                             to for it to be properly cleared -- thus we
> diff --git a/target/arm/translate.c b/target/arm/translate.c
> index 2ae68ce..83e5491 100644
> --- a/target/arm/translate.c
> +++ b/target/arm/translate.c
> @@ -11942,6 +11942,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
>                          dc->is_jmp = DISAS_UPDATE;
>                      } else {
>                          gen_exception_internal_insn(dc, 0, EXCP_DEBUG);
> +                        dc->is_jmp = DISAS_NORETURN;

gen_exception_internal_insn already sets dc->is_jmp to DISAS_NORETURN,
as per patch 04/34:
@@ -304,7 +304,7 @@ static void gen_exception_internal_insn(DisasContext *s, int offset, int excp)
 {
     gen_a64_set_pc_im(s->pc - offset);
     gen_exception_internal(excp);
-    s->is_jmp = DISAS_EXC;
+    s->is_jmp = DISAS_NORETURN;
 }

This applies to both arm and a64.

Why do we need to set is_jmp again, then?

		E.
LluĂ­s Vilanova July 21, 2017, 10:39 p.m. UTC | #2
Richard Henderson writes:

> We have generated an exception, so use DISAS_NORETURN.

Shouldn't this be folded into patch 4?

Thanks,
  Lluis


> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>  target/arm/translate-a64.c | 1 +
>  target/arm/translate.c     | 4 +++-
>  2 files changed, 4 insertions(+), 1 deletion(-)

> diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
> index 342ff7c..657684b 100644
> --- a/target/arm/translate-a64.c
> +++ b/target/arm/translate-a64.c
> @@ -11285,6 +11285,7 @@ void gen_intermediate_code_a64(CPUState *cs, TranslationBlock *tb)
dc-> is_jmp = DISAS_UPDATE;
>                      } else {
>                          gen_exception_internal_insn(dc, 0, EXCP_DEBUG);
> +                        dc->is_jmp = DISAS_NORETURN;
>                          /* The address covered by the breakpoint must be
>                             included in [tb->pc, tb->pc + tb->size) in order
>                             to for it to be properly cleared -- thus we
> diff --git a/target/arm/translate.c b/target/arm/translate.c
> index 2ae68ce..83e5491 100644
> --- a/target/arm/translate.c
> +++ b/target/arm/translate.c
> @@ -11942,6 +11942,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
dc-> is_jmp = DISAS_UPDATE;
>                      } else {
>                          gen_exception_internal_insn(dc, 0, EXCP_DEBUG);
> +                        dc->is_jmp = DISAS_NORETURN;
>                          /* The address covered by the breakpoint must be
>                             included in [tb->pc, tb->pc + tb->size) in order
>                             to for it to be properly cleared -- thus we
> @@ -11986,7 +11987,8 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
>              assert(num_insns == 1);
>              gen_exception(EXCP_UDEF, syn_swstep(dc->ss_same_el, 0, 0),
>                            default_exception_el(dc));
> -            goto done_generating;
> +            dc->is_jmp = DISAS_NORETURN;
> +            break;
>          }
 
>          if (dc->thumb) {
> -- 
> 2.9.4
Richard Henderson July 22, 2017, 10:39 a.m. UTC | #3
On 07/21/2017 11:37 AM, Emilio G. Cota wrote:
>>                           gen_exception_internal_insn(dc, 0, EXCP_DEBUG);
>> +                        dc->is_jmp = DISAS_NORETURN;
> 
> gen_exception_internal_insn already sets dc->is_jmp to DISAS_NORETURN,
> as per patch 04/34:
> @@ -304,7 +304,7 @@ static void gen_exception_internal_insn(DisasContext *s, int offset, int excp)
>   {
>       gen_a64_set_pc_im(s->pc - offset);
>       gen_exception_internal(excp);
> -    s->is_jmp = DISAS_EXC;
> +    s->is_jmp = DISAS_NORETURN;
>   }
> 
> This applies to both arm and a64.
> 
> Why do we need to set is_jmp again, then?

Because I confused gen_exception_internal, which does not.
I have dropped this patch.


r~

Patch
diff mbox

diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index 342ff7c..657684b 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -11285,6 +11285,7 @@  void gen_intermediate_code_a64(CPUState *cs, TranslationBlock *tb)
                         dc->is_jmp = DISAS_UPDATE;
                     } else {
                         gen_exception_internal_insn(dc, 0, EXCP_DEBUG);
+                        dc->is_jmp = DISAS_NORETURN;
                         /* The address covered by the breakpoint must be
                            included in [tb->pc, tb->pc + tb->size) in order
                            to for it to be properly cleared -- thus we
diff --git a/target/arm/translate.c b/target/arm/translate.c
index 2ae68ce..83e5491 100644
--- a/target/arm/translate.c
+++ b/target/arm/translate.c
@@ -11942,6 +11942,7 @@  void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
                         dc->is_jmp = DISAS_UPDATE;
                     } else {
                         gen_exception_internal_insn(dc, 0, EXCP_DEBUG);
+                        dc->is_jmp = DISAS_NORETURN;
                         /* The address covered by the breakpoint must be
                            included in [tb->pc, tb->pc + tb->size) in order
                            to for it to be properly cleared -- thus we
@@ -11986,7 +11987,8 @@  void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
             assert(num_insns == 1);
             gen_exception(EXCP_UDEF, syn_swstep(dc->ss_same_el, 0, 0),
                           default_exception_el(dc));
-            goto done_generating;
+            dc->is_jmp = DISAS_NORETURN;
+            break;
         }
 
         if (dc->thumb) {