qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] target/sparc: Fix gdbstub incorrectly handling registers f32-f62
@ 2025-02-03 14:50 Mikael Szreder
  2025-02-13 15:12 ` Mikael Szreder
  2025-02-13 16:57 ` Richard Henderson
  0 siblings, 2 replies; 5+ messages in thread
From: Mikael Szreder @ 2025-02-03 14:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: Richard Henderson, Mark Cave-Ayland, Artyom Tarasenko,
	Mikael Szreder

The gdbstub implementation for the Sparc architecture would incorectly
 calculate the the floating point register offset.
This would cause register pairs(eg f32,f33) to point to the same value.

Fixes: 30038fd81808 ("target-sparc: Change fpr representation to doubles.")
Signed-off-by: Mikael Szreder <git@miszr.win>
---
 target/sparc/gdbstub.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/sparc/gdbstub.c b/target/sparc/gdbstub.c
index ec0036e9ef..5578fa9813 100644
--- a/target/sparc/gdbstub.c
+++ b/target/sparc/gdbstub.c
@@ -80,7 +80,7 @@ int sparc_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
     }
     if (n < 80) {
         /* f32-f62 (double width, even numbers only) */
-        return gdb_get_reg64(mem_buf, env->fpr[(n - 32) / 2].ll);
+        return gdb_get_reg64(mem_buf, env->fpr[(n - 64) + 16].ll);
     }
     switch (n) {
     case 80:
@@ -174,7 +174,7 @@ int sparc_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
         return 4;
     } else if (n < 80) {
         /* f32-f62 (double width, even numbers only) */
-        env->fpr[(n - 32) / 2].ll = tmp;
+        env->fpr[(n - 64) + 16].ll = tmp;
     } else {
         switch (n) {
         case 80:
-- 
2.48.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-02-13 19:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-03 14:50 [PATCH] target/sparc: Fix gdbstub incorrectly handling registers f32-f62 Mikael Szreder
2025-02-13 15:12 ` Mikael Szreder
2025-02-13 16:57 ` Richard Henderson
2025-02-13 19:03   ` Mikael Szreder
2025-02-13 19:11     ` Richard Henderson

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).