All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] target/arm: Drop unsupported_encoding() macro
@ 2022-05-09 16:04 Peter Maydell
  2022-05-09 17:49 ` Philippe Mathieu-Daudé via
  2022-05-09 20:42 ` Richard Henderson
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Maydell @ 2022-05-09 16:04 UTC (permalink / raw)
  To: qemu-arm, qemu-devel

The unsupported_encoding() macro logs a LOG_UNIMP message and then
generates code to raise the usual exception for an unallocated
encoding.  Back when we were still implementing the A64 decoder this
was helpful for flagging up when guest code was using something we
hadn't yet implemented.  Now we completely cover the A64 instruction
set it is barely used.  The only remaining uses are for five
instructions whose semantics are "UNDEF, unless being run under
external halting debug":
 * HLT (when not being used for semihosting)
 * DCPSR1, DCPS2, DCPS3
 * DRPS

QEMU doesn't implement external halting debug, so for us the UNDEF is
the architecturally correct behaviour (because it's not possible to
execute these instructions with halting debug enabled).  The
LOG_UNIMP doesn't serve a useful purpose; replace these uses of
unsupported_encoding() with unallocated_encoding(), and delete the
macro.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/translate-a64.h | 9 ---------
 target/arm/translate-a64.c | 8 ++++----
 2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h
index 38884158aab..f2e8ee0ee1f 100644
--- a/target/arm/translate-a64.h
+++ b/target/arm/translate-a64.h
@@ -18,15 +18,6 @@
 #ifndef TARGET_ARM_TRANSLATE_A64_H
 #define TARGET_ARM_TRANSLATE_A64_H
 
-#define unsupported_encoding(s, insn)                                    \
-    do {                                                                 \
-        qemu_log_mask(LOG_UNIMP,                                         \
-                      "%s:%d: unsupported instruction encoding 0x%08x "  \
-                      "at pc=%016" PRIx64 "\n",                          \
-                      __FILE__, __LINE__, insn, s->pc_curr);             \
-        unallocated_encoding(s);                                         \
-    } while (0)
-
 TCGv_i64 new_tmp_a64(DisasContext *s);
 TCGv_i64 new_tmp_a64_local(DisasContext *s);
 TCGv_i64 new_tmp_a64_zero(DisasContext *s);
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index b80313670f9..290ad6cbb27 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -2085,13 +2085,13 @@ static void disas_exc(DisasContext *s, uint32_t insn)
              * with our 32-bit semihosting).
              */
             if (s->current_el == 0) {
-                unsupported_encoding(s, insn);
+                unallocated_encoding(s);
                 break;
             }
 #endif
             gen_exception_internal_insn(s, s->pc_curr, EXCP_SEMIHOST);
         } else {
-            unsupported_encoding(s, insn);
+            unallocated_encoding(s);
         }
         break;
     case 5:
@@ -2100,7 +2100,7 @@ static void disas_exc(DisasContext *s, uint32_t insn)
             break;
         }
         /* DCPS1, DCPS2, DCPS3 */
-        unsupported_encoding(s, insn);
+        unallocated_encoding(s);
         break;
     default:
         unallocated_encoding(s);
@@ -2265,7 +2265,7 @@ static void disas_uncond_b_reg(DisasContext *s, uint32_t insn)
         if (op3 != 0 || op4 != 0 || rn != 0x1f) {
             goto do_unallocated;
         } else {
-            unsupported_encoding(s, insn);
+            unallocated_encoding(s);
         }
         return;
 
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] target/arm: Drop unsupported_encoding() macro
  2022-05-09 16:04 [PATCH] target/arm: Drop unsupported_encoding() macro Peter Maydell
@ 2022-05-09 17:49 ` Philippe Mathieu-Daudé via
  2022-05-09 20:42 ` Richard Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé via @ 2022-05-09 17:49 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-arm, qemu-devel@nongnu.org Developers

On Mon, May 9, 2022 at 6:05 PM Peter Maydell <peter.maydell@linaro.org> wrote:
>
> The unsupported_encoding() macro logs a LOG_UNIMP message and then
> generates code to raise the usual exception for an unallocated
> encoding.  Back when we were still implementing the A64 decoder this
> was helpful for flagging up when guest code was using something we
> hadn't yet implemented.  Now we completely cover the A64 instruction
> set it is barely used.  The only remaining uses are for five
> instructions whose semantics are "UNDEF, unless being run under
> external halting debug":
>  * HLT (when not being used for semihosting)
>  * DCPSR1, DCPS2, DCPS3
>  * DRPS
>
> QEMU doesn't implement external halting debug, so for us the UNDEF is
> the architecturally correct behaviour (because it's not possible to
> execute these instructions with halting debug enabled).  The
> LOG_UNIMP doesn't serve a useful purpose; replace these uses of
> unsupported_encoding() with unallocated_encoding(), and delete the
> macro.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  target/arm/translate-a64.h | 9 ---------
>  target/arm/translate-a64.c | 8 ++++----
>  2 files changed, 4 insertions(+), 13 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] target/arm: Drop unsupported_encoding() macro
  2022-05-09 16:04 [PATCH] target/arm: Drop unsupported_encoding() macro Peter Maydell
  2022-05-09 17:49 ` Philippe Mathieu-Daudé via
@ 2022-05-09 20:42 ` Richard Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2022-05-09 20:42 UTC (permalink / raw)
  To: Peter Maydell, qemu-arm, qemu-devel

On 5/9/22 11:04, Peter Maydell wrote:
> The unsupported_encoding() macro logs a LOG_UNIMP message and then
> generates code to raise the usual exception for an unallocated
> encoding.  Back when we were still implementing the A64 decoder this
> was helpful for flagging up when guest code was using something we
> hadn't yet implemented.  Now we completely cover the A64 instruction
> set it is barely used.  The only remaining uses are for five
> instructions whose semantics are "UNDEF, unless being run under
> external halting debug":
>   * HLT (when not being used for semihosting)
>   * DCPSR1, DCPS2, DCPS3
>   * DRPS
> 
> QEMU doesn't implement external halting debug, so for us the UNDEF is
> the architecturally correct behaviour (because it's not possible to
> execute these instructions with halting debug enabled).  The
> LOG_UNIMP doesn't serve a useful purpose; replace these uses of
> unsupported_encoding() with unallocated_encoding(), and delete the
> macro.
> 
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
> ---
>   target/arm/translate-a64.h | 9 ---------
>   target/arm/translate-a64.c | 8 ++++----
>   2 files changed, 4 insertions(+), 13 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-09 20:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09 16:04 [PATCH] target/arm: Drop unsupported_encoding() macro Peter Maydell
2022-05-09 17:49 ` Philippe Mathieu-Daudé via
2022-05-09 20:42 ` Richard Henderson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.