@samitouri / QOSamiQemu / commits / 95256e5d50

target/sh4: sync fp_status when gdb writes FPSCR

sh4_cpu_gdb_write_register() wrote the incoming FPSCR value straight into env->fpscr, leaving the derived env->fp_status (rounding mode and flush-to-zero) stale, so a gdb-initiated FPSCR change did not take effect for subsequent FP operations. Use cpu_load_fpscr() instead, the same way the adjacent case already uses cpu_write_sr() for SR. Cc: qemu-stable@nongnu.org Reviewed-by: Yoshinori Sato <yoshinori.sato@nifty.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Helge Deller <deller@gmx.de>

Matt Turner committed May 25, 2026 at 11:26 UTC 95256e5d503d11e6163fd7f0d58a478ca7ebe099
1 file changed +1 -1
target/sh4/gdbstub.c
+1 -1
@@ -113,7 +113,7 @@ int superh_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
113 env->fpul = ldl_p(mem_buf);
114 break;
115 case 24:
116 - env->fpscr = ldl_p(mem_buf);
116 + cpu_load_fpscr(env, ldl_p(mem_buf));
117 break;
118 case 25 ... 40:
119 if (env->fpscr & FPSCR_FR) {