* [Qemu-devel] [PATCH] target-mips: Add missing calls to synchronise SoftFloat status
@ 2014-12-02 17:02 Maciej W. Rozycki
2014-12-02 17:19 ` Peter Maydell
2014-12-11 15:27 ` Leon Alrae
0 siblings, 2 replies; 4+ messages in thread
From: Maciej W. Rozycki @ 2014-12-02 17:02 UTC (permalink / raw)
To: qemu-devel; +Cc: Leon Alrae, Thomas Schwinge, Aurelien Jarno
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>
---
qemu-mips-softfloat-status.diff
Index: qemu-git-trunk/target-mips/cpu.h
===================================================================
--- qemu-git-trunk.orig/target-mips/cpu.h 2014-12-02 16:29:15.000000000 +0000
+++ qemu-git-trunk/target-mips/cpu.h 2014-12-02 16:32:49.127585631 +0000
@@ -777,6 +777,18 @@ target_ulong exception_resume_pc (CPUMIP
extern unsigned int ieee_rm[];
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,
target_ulong *cs_base, int *flags)
{
Index: qemu-git-trunk/target-mips/gdbstub.c
===================================================================
--- qemu-git-trunk.orig/target-mips/gdbstub.c 2014-12-02 16:29:15.000000000 +0000
+++ qemu-git-trunk/target-mips/gdbstub.c 2014-12-02 16:32:49.127585631 +0000
@@ -74,10 +74,6 @@ int mips_cpu_gdb_read_register(CPUState
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)
{
MIPSCPU *cpu = MIPS_CPU(cs);
@@ -95,7 +91,9 @@ int mips_cpu_gdb_write_register(CPUState
case 70:
env->active_fpu.fcr31 = tmp & 0xFF83FFFF;
/* set rounding mode */
- RESTORE_ROUNDING_MODE;
+ restore_rounding_mode(env);
+ /* set flush-to-zero mode */
+ restore_flush_mode(env);
break;
case 71:
/* FIR is read-only. Ignore writes. */
Index: qemu-git-trunk/target-mips/op_helper.c
===================================================================
--- qemu-git-trunk.orig/target-mips/op_helper.c 2014-12-02 16:29:14.000000000 +0000
+++ qemu-git-trunk/target-mips/op_helper.c 2014-12-02 16:32:49.127585631 +0000
@@ -2280,18 +2280,6 @@ unsigned int ieee_rm[] = {
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 arg1 = 0;
Index: qemu-git-trunk/target-mips/translate.c
===================================================================
--- qemu-git-trunk.orig/target-mips/translate.c 2014-12-02 16:29:14.000000000 +0000
+++ qemu-git-trunk/target-mips/translate.c 2014-12-02 16:32:49.127585631 +0000
@@ -19615,6 +19615,8 @@ void cpu_state_reset(CPUMIPSState *env)
}
compute_hflags(env);
+ restore_rounding_mode(env);
+ restore_flush_mode(env);
cs->exception_index = EXCP_NONE;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] target-mips: Add missing calls to synchronise SoftFloat status
2014-12-02 17:02 [Qemu-devel] [PATCH] target-mips: Add missing calls to synchronise SoftFloat status Maciej W. Rozycki
@ 2014-12-02 17:19 ` Peter Maydell
2014-12-02 17:26 ` Maciej W. Rozycki
2014-12-11 15:27 ` Leon Alrae
1 sibling, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2014-12-02 17:19 UTC (permalink / raw)
To: Maciej W. Rozycki
Cc: Leon Alrae, QEMU Developers, Aurelien Jarno, Thomas Schwinge
On 2 December 2014 at 17:02, Maciej W. Rozycki <macro@codesourcery.com> wrote:
> 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.
> @@ -95,7 +91,9 @@ int mips_cpu_gdb_write_register(CPUState
> case 70:
> env->active_fpu.fcr31 = tmp & 0xFF83FFFF;
> /* set rounding mode */
> - RESTORE_ROUNDING_MODE;
> + restore_rounding_mode(env);
> + /* set flush-to-zero mode */
> + restore_flush_mode(env);
> break;
> @@ -19615,6 +19615,8 @@ void cpu_state_reset(CPUMIPSState *env)
> }
>
> compute_hflags(env);
> + restore_rounding_mode(env);
> + restore_flush_mode(env);
> cs->exception_index = EXCP_NONE;
Is there ever a situation where you would want to
resynchronise only one of these two things? If not,
why not just have one function for synchronising
softfloat state from the FCR?
thanks
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] target-mips: Add missing calls to synchronise SoftFloat status
2014-12-02 17:19 ` Peter Maydell
@ 2014-12-02 17:26 ` Maciej W. Rozycki
0 siblings, 0 replies; 4+ messages in thread
From: Maciej W. Rozycki @ 2014-12-02 17:26 UTC (permalink / raw)
To: Peter Maydell
Cc: Leon Alrae, QEMU Developers, Aurelien Jarno, Thomas Schwinge
On Tue, 2 Dec 2014, Peter Maydell wrote:
> Is there ever a situation where you would want to
> resynchronise only one of these two things? If not,
> why not just have one function for synchronising
> softfloat state from the FCR?
Good point, I think these are safe and cheap enough to be always called
together. It sounds like a good idea for a future improvement.
Thanks!
Maciej
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] target-mips: Add missing calls to synchronise SoftFloat status
2014-12-02 17:02 [Qemu-devel] [PATCH] target-mips: Add missing calls to synchronise SoftFloat status Maciej W. Rozycki
2014-12-02 17:19 ` Peter Maydell
@ 2014-12-11 15:27 ` Leon Alrae
1 sibling, 0 replies; 4+ messages in thread
From: Leon Alrae @ 2014-12-11 15:27 UTC (permalink / raw)
To: Maciej W. Rozycki, qemu-devel; +Cc: Thomas Schwinge, Aurelien Jarno
On 02/12/2014 17:02, Maciej W. Rozycki wrote:
> 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>
> ---
> qemu-mips-softfloat-status.diff
> Index: qemu-git-trunk/target-mips/cpu.h
> Index: qemu-git-trunk/target-mips/gdbstub.c
> Index: qemu-git-trunk/target-mips/op_helper.c
> Index: qemu-git-trunk/target-mips/translate.c
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-12-11 15:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-02 17:02 [Qemu-devel] [PATCH] target-mips: Add missing calls to synchronise SoftFloat status Maciej W. Rozycki
2014-12-02 17:19 ` Peter Maydell
2014-12-02 17:26 ` Maciej W. Rozycki
2014-12-11 15:27 ` Leon Alrae
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).