mirror of https://github.com/xemu-project/xemu.git
target/mips: Introduce ase_mt_available() helper
Instead of accessing CP0_Config3 directly and checking the 'Multi-Threading Present' bit, introduce an helper to simplify code review. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20201204222622.2743175-3-f4bug@amsat.org>
This commit is contained in:
parent
585c80ad7b
commit
17c2c320f3
|
@ -58,8 +58,7 @@ static void main_cpu_reset(void *opaque)
|
||||||
|
|
||||||
static bool cpu_mips_itu_supported(CPUMIPSState *env)
|
static bool cpu_mips_itu_supported(CPUMIPSState *env)
|
||||||
{
|
{
|
||||||
bool is_mt = (env->CP0_Config5 & (1 << CP0C5_VP)) ||
|
bool is_mt = (env->CP0_Config5 & (1 << CP0C5_VP)) || ase_mt_available(env);
|
||||||
(env->CP0_Config3 & (1 << CP0C3_MT));
|
|
||||||
|
|
||||||
return is_mt && !kvm_enabled();
|
return is_mt && !kvm_enabled();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1164,7 +1164,7 @@ void helper_mtc0_entryhi(CPUMIPSState *env, target_ulong arg1)
|
||||||
old = env->CP0_EntryHi;
|
old = env->CP0_EntryHi;
|
||||||
val = (arg1 & mask) | (old & ~mask);
|
val = (arg1 & mask) | (old & ~mask);
|
||||||
env->CP0_EntryHi = val;
|
env->CP0_EntryHi = val;
|
||||||
if (env->CP0_Config3 & (1 << CP0C3_MT)) {
|
if (ase_mt_available(env)) {
|
||||||
sync_c0_entryhi(env, env->current_tc);
|
sync_c0_entryhi(env, env->current_tc);
|
||||||
}
|
}
|
||||||
/* If the ASID changes, flush qemu's TLB. */
|
/* If the ASID changes, flush qemu's TLB. */
|
||||||
|
|
|
@ -74,7 +74,7 @@ static bool mips_cpu_has_work(CPUState *cs)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MIPS-MT has the ability to halt the CPU. */
|
/* MIPS-MT has the ability to halt the CPU. */
|
||||||
if (env->CP0_Config3 & (1 << CP0C3_MT)) {
|
if (ase_mt_available(env)) {
|
||||||
/*
|
/*
|
||||||
* The QEMU model will issue an _WAKE request whenever the CPUs
|
* The QEMU model will issue an _WAKE request whenever the CPUs
|
||||||
* should be woken up.
|
* should be woken up.
|
||||||
|
|
|
@ -1289,6 +1289,13 @@ int cpu_mips_signal_handler(int host_signum, void *pinfo, void *puc);
|
||||||
bool cpu_type_supports_cps_smp(const char *cpu_type);
|
bool cpu_type_supports_cps_smp(const char *cpu_type);
|
||||||
bool cpu_supports_isa(const CPUMIPSState *env, uint64_t isa_mask);
|
bool cpu_supports_isa(const CPUMIPSState *env, uint64_t isa_mask);
|
||||||
bool cpu_type_supports_isa(const char *cpu_type, uint64_t isa);
|
bool cpu_type_supports_isa(const char *cpu_type, uint64_t isa);
|
||||||
|
|
||||||
|
/* Check presence of multi-threading ASE implementation */
|
||||||
|
static inline bool ase_mt_available(CPUMIPSState *env)
|
||||||
|
{
|
||||||
|
return env->CP0_Config3 & (1 << CP0C3_MT);
|
||||||
|
}
|
||||||
|
|
||||||
void cpu_set_exception_base(int vp_index, target_ulong address);
|
void cpu_set_exception_base(int vp_index, target_ulong address);
|
||||||
|
|
||||||
/* addr.c */
|
/* addr.c */
|
||||||
|
|
|
@ -419,7 +419,7 @@ void cpu_mips_store_status(CPUMIPSState *env, target_ulong val)
|
||||||
tlb_flush(env_cpu(env));
|
tlb_flush(env_cpu(env));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (env->CP0_Config3 & (1 << CP0C3_MT)) {
|
if (ase_mt_available(env)) {
|
||||||
sync_c0_status(env, env, env->current_tc);
|
sync_c0_status(env, env, env->current_tc);
|
||||||
} else {
|
} else {
|
||||||
compute_hflags(env);
|
compute_hflags(env);
|
||||||
|
|
|
@ -31917,7 +31917,7 @@ void cpu_state_reset(CPUMIPSState *env)
|
||||||
|
|
||||||
cpu_mips_store_count(env, 1);
|
cpu_mips_store_count(env, 1);
|
||||||
|
|
||||||
if (env->CP0_Config3 & (1 << CP0C3_MT)) {
|
if (ase_mt_available(env)) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Only TC0 on VPE 0 starts as active. */
|
/* Only TC0 on VPE 0 starts as active. */
|
||||||
|
|
Loading…
Reference in New Issue