target-mips: Add missing calls to synchronise SoftFloat status
Add missing calls to synchronise the SoftFloat status with the CP1.FSCR: + for the rounding and flush-to-zero modes upon processor reset, + for the flush-to-zero mode on FSCR updates through the GDB stub. Refactor code accordingly and remove the redundant RESTORE_ROUNDING_MODE macro. Signed-off-by: Thomas Schwinge <thomas@codesourcery.com> Signed-off-by: Maciej W. Rozycki <macro@codesourcery.com> Reviewed-by: Leon Alrae <leon.alrae@imgtec.com> Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
This commit is contained in:
parent
74797f40dc
commit
bb962386b8
|
@ -777,6 +777,18 @@ target_ulong exception_resume_pc (CPUMIPSState *env);
|
||||||
extern unsigned int ieee_rm[];
|
extern unsigned int ieee_rm[];
|
||||||
int ieee_ex_to_mips(int xcpt);
|
int ieee_ex_to_mips(int xcpt);
|
||||||
|
|
||||||
|
static inline void restore_rounding_mode(CPUMIPSState *env)
|
||||||
|
{
|
||||||
|
set_float_rounding_mode(ieee_rm[env->active_fpu.fcr31 & 3],
|
||||||
|
&env->active_fpu.fp_status);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void restore_flush_mode(CPUMIPSState *env)
|
||||||
|
{
|
||||||
|
set_flush_to_zero((env->active_fpu.fcr31 & (1 << 24)) != 0,
|
||||||
|
&env->active_fpu.fp_status);
|
||||||
|
}
|
||||||
|
|
||||||
static inline void cpu_get_tb_cpu_state(CPUMIPSState *env, target_ulong *pc,
|
static inline void cpu_get_tb_cpu_state(CPUMIPSState *env, target_ulong *pc,
|
||||||
target_ulong *cs_base, int *flags)
|
target_ulong *cs_base, int *flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -74,10 +74,6 @@ int mips_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RESTORE_ROUNDING_MODE \
|
|
||||||
set_float_rounding_mode(ieee_rm[env->active_fpu.fcr31 & 3], \
|
|
||||||
&env->active_fpu.fp_status)
|
|
||||||
|
|
||||||
int mips_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
|
int mips_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
|
||||||
{
|
{
|
||||||
MIPSCPU *cpu = MIPS_CPU(cs);
|
MIPSCPU *cpu = MIPS_CPU(cs);
|
||||||
|
@ -95,7 +91,9 @@ int mips_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
|
||||||
case 70:
|
case 70:
|
||||||
env->active_fpu.fcr31 = tmp & 0xFF83FFFF;
|
env->active_fpu.fcr31 = tmp & 0xFF83FFFF;
|
||||||
/* set rounding mode */
|
/* set rounding mode */
|
||||||
RESTORE_ROUNDING_MODE;
|
restore_rounding_mode(env);
|
||||||
|
/* set flush-to-zero mode */
|
||||||
|
restore_flush_mode(env);
|
||||||
break;
|
break;
|
||||||
case 71:
|
case 71:
|
||||||
/* FIR is read-only. Ignore writes. */
|
/* FIR is read-only. Ignore writes. */
|
||||||
|
|
|
@ -2280,18 +2280,6 @@ unsigned int ieee_rm[] = {
|
||||||
float_round_down
|
float_round_down
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline void restore_rounding_mode(CPUMIPSState *env)
|
|
||||||
{
|
|
||||||
set_float_rounding_mode(ieee_rm[env->active_fpu.fcr31 & 3],
|
|
||||||
&env->active_fpu.fp_status);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void restore_flush_mode(CPUMIPSState *env)
|
|
||||||
{
|
|
||||||
set_flush_to_zero((env->active_fpu.fcr31 & (1 << 24)) != 0,
|
|
||||||
&env->active_fpu.fp_status);
|
|
||||||
}
|
|
||||||
|
|
||||||
target_ulong helper_cfc1(CPUMIPSState *env, uint32_t reg)
|
target_ulong helper_cfc1(CPUMIPSState *env, uint32_t reg)
|
||||||
{
|
{
|
||||||
target_ulong arg1 = 0;
|
target_ulong arg1 = 0;
|
||||||
|
|
|
@ -19617,6 +19617,8 @@ void cpu_state_reset(CPUMIPSState *env)
|
||||||
}
|
}
|
||||||
|
|
||||||
compute_hflags(env);
|
compute_hflags(env);
|
||||||
|
restore_rounding_mode(env);
|
||||||
|
restore_flush_mode(env);
|
||||||
cs->exception_index = EXCP_NONE;
|
cs->exception_index = EXCP_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue