target-mips: Fix RDHWR on CP0.Count

For RDHWR on the CP0.Count register, env->CP0_Count was being returned.
This value is a delta against the QEMU_CLOCK_VIRTUAL clock, not the
correct current value of CP0.Count. Use cpu_mips_get_count() instead.

Backports commit cdfcad788394ff53e317043e07b8e34f4987c659 from qemu
This commit is contained in:
Alex Smith 2018-02-15 15:44:18 -05:00 committed by Lioncash
parent dfa3d51a0f
commit c48b0f76ee
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -2191,10 +2191,15 @@ target_ulong helper_rdhwr_synci_step(CPUMIPSState *env)
target_ulong helper_rdhwr_cc(CPUMIPSState *env)
{
if ((env->hflags & MIPS_HFLAG_CP0) ||
(env->CP0_HWREna & (1 << 2)))
(env->CP0_HWREna & (1 << 2))) {
#ifdef CONFIG_USER_ONLY
return env->CP0_Count;
else
#else
return (int32_t)cpu_mips_get_count(env);
#endif
} else {
helper_raise_exception(env, EXCP_RI);
}
return 0;
}