target/mips: Introduce cpu_supports_isa() taking CPUMIPSState argument
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>
Mon, 7 Dec 2020 21:33:22 +0000 (22:33 +0100)
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>
Sun, 13 Dec 2020 18:58:54 +0000 (19:58 +0100)
Introduce cpu_supports_isa() which takes a CPUMIPSState
argument, more useful at runtime when the CPU is created
(no need to call the extensive object_class_by_name()).

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201207215257.4004222-3-f4bug@amsat.org>

target/mips/cpu.c
target/mips/cpu.h

index 76d50b00b42b38d0c266fe735d4127ddf51b20d8..687e2680dd1209e8a45fc0056ac8d3e2d64176d6 100644 (file)
@@ -310,3 +310,8 @@ MIPSCPU *mips_cpu_create_with_clock(const char *cpu_type, Clock *cpu_refclk)
 
     return MIPS_CPU(cpu);
 }
+
+bool cpu_supports_isa(const CPUMIPSState *env, uint64_t isa_mask)
+{
+    return (env->cpu_model->insn_flags & isa_mask) != 0;
+}
index 9c65c87bf997cd2579006457dec45cc618a8954b..e8bca75f23750b6ae8dec7e76b4bc2bee345f321 100644 (file)
@@ -1287,6 +1287,7 @@ int cpu_mips_signal_handler(int host_signum, void *pinfo, void *puc);
 #define CPU_RESOLVING_TYPE TYPE_MIPS_CPU
 
 bool cpu_type_supports_cps_smp(const char *cpu_type);
+bool cpu_supports_isa(const CPUMIPSState *env, uint64_t isa_mask);
 bool cpu_type_supports_isa(const char *cpu_type, uint64_t isa);
 void cpu_set_exception_base(int vp_index, target_ulong address);