]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
target/mips: Extract decode_64bit_enabled() helper
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Sat, 26 Oct 2024 17:15:26 +0000 (14:15 -0300)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Sun, 3 Nov 2024 08:49:12 +0000 (05:49 -0300)
Extract the decode_64bit_enabled() helper which detects
whether CPUs can run 64-bit instructions.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20241026175349.84523-2-philmd@linaro.org>

target/mips/tcg/translate.c
target/mips/tcg/translate.h

index d92fc418edda59a1d9387fca1e6a5d05de147ac5..6c881af561859dc09eae367d84f66523587222b5 100644 (file)
@@ -1645,13 +1645,18 @@ static inline void check_ps(DisasContext *ctx)
     check_cp1_64bitmode(ctx);
 }
 
+bool decode_64bit_enabled(DisasContext *ctx)
+{
+    return ctx->hflags & MIPS_HFLAG_64;
+}
+
 /*
  * This code generates a "reserved instruction" exception if cpu is not
  * 64-bit or 64-bit instructions are not enabled.
  */
 void check_mips_64(DisasContext *ctx)
 {
-    if (unlikely((TARGET_LONG_BITS != 64) || !(ctx->hflags & MIPS_HFLAG_64))) {
+    if (unlikely((TARGET_LONG_BITS != 64) || !decode_64bit_enabled(ctx))) {
         gen_reserved_instruction(ctx);
     }
 }
index 5d196e69ac420983fe109d730aae71cf7ac585cb..ae6c25aa0c4832341f033cf7d8e2278aaf0cd1d5 100644 (file)
@@ -217,6 +217,8 @@ void msa_translate_init(void);
 void mxu_translate_init(void);
 bool decode_ase_mxu(DisasContext *ctx, uint32_t insn);
 
+bool decode_64bit_enabled(DisasContext *ctx);
+
 /* decodetree generated */
 bool decode_isa_rel6(DisasContext *ctx, uint32_t insn);
 bool decode_ase_msa(DisasContext *ctx, uint32_t insn);