Skip to contentSkip to conversation

PPC/GDB: handle read and write of fpscr

PATCH Applied Fabien Chouteau 2 participants 2 messages Mar 19, 2013 – Mar 21, 2013

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 PPC/GDB: handle read and write of fpscr

Although the support of this register may be uncomplete, there are no reason to prevent the debugger from reading or writing it.

---
 gdbstub.c                   |    3 ++-
 target-ppc/cpu.h            |    2 ++
 target-ppc/fpu_helper.c     |    5 +++++
 target-ppc/translate_init.c |    2 +-
 4 files changed, 10 insertions(+), 2 deletions(-)
gdbstub.c +2 -1
index e414ad9..d12ce52 100644
@@ -781,7 +781,8 @@ static int cpu_gdb_write_register(CPUPPCState *env, uint8_t *mem_buf, int n)
             /* fpscr */
             if (gdb_has_xml)
                 return 0;
-            return 4;
+            store_fpscr(env, ldtul_p(mem_buf), 0xffffffff);
+            return sizeof(target_ulong);
         }
     }
     return 0;
target-ppc/cpu.h +2 -0
index 417abb0..543f367 100644
@@ -1181,6 +1181,8 @@ void ppc_tlb_invalidate_one (CPUPPCState *env, target_ulong addr);
 #endif
 #endif
 
+void store_fpscr(CPUPPCState *env, uint64_t arg, uint32_t mask);
+
 static inline uint64_t ppc_dump_gpr(CPUPPCState *env, int gprn)
 {
     uint64_t gprv;
target-ppc/fpu_helper.c +5 -0
index 9d67926..9e779ea 100644
@@ -463,6 +463,11 @@ void helper_store_fpscr(CPUPPCState *env, uint64_t arg, uint32_t mask)
     fpscr_set_rounding_mode(env);
 }
 
+void store_fpscr(CPUPPCState *env, uint64_t arg, uint32_t mask)
+{
+    helper_store_fpscr(env, arg, mask);
+}
+
 void helper_float_check_status(CPUPPCState *env)
 {
     if (env->exception_index == POWERPC_EXCP_PROGRAM &&
target-ppc/translate_init.c +1 -1
index 09ad4ba..8511b2f 100644
@@ -7693,7 +7693,7 @@ static int gdb_set_float_reg(CPUPPCState *env, uint8_t *mem_buf, int n)
         return 8;
     }
     if (n == 32) {
-        /* FPSCR not implemented  */
+        helper_store_fpscr(env, ldl_p(mem_buf), 0xffffffff);
         return 4;
     }
     return 0;
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 4 lines · Fabien Chouteau

Although the support of this register may be uncomplete, there are no reason to prevent the debugger from reading or writing it.

Thanks, applied to ppc-next.

Alex

Quoted 66 lines

---

gdbstub.c                   |    3 ++-
target-ppc/cpu.h            |    2 ++
target-ppc/fpu_helper.c     |    5 +++++
target-ppc/translate_init.c |    2 +-
4 files changed, 10 insertions(+), 2 deletions(-)
gdbstub.c +2 -1
index e414ad9..d12ce52 100644
@@ -781,7 +781,8 @@ static int cpu_gdb_write_register(CPUPPCState *env, uint8_t *mem_buf, int n)
            /* fpscr */
            if (gdb_has_xml)
                return 0;
-            return 4;
+            store_fpscr(env, ldtul_p(mem_buf), 0xffffffff);
+            return sizeof(target_ulong);
        }
    }
    return 0;
target-ppc/cpu.h +2 -0
index 417abb0..543f367 100644
@@ -1181,6 +1181,8 @@ void ppc_tlb_invalidate_one (CPUPPCState *env, target_ulong addr);
 #endif
 #endif
 
+void store_fpscr(CPUPPCState *env, uint64_t arg, uint32_t mask);
+
 static inline uint64_t ppc_dump_gpr(CPUPPCState *env, int gprn)
 {
    uint64_t gprv;
target-ppc/fpu_helper.c +5 -0
index 9d67926..9e779ea 100644
@@ -463,6 +463,11 @@ void helper_store_fpscr(CPUPPCState *env, uint64_t arg, uint32_t mask)
    fpscr_set_rounding_mode(env);
 }
 
+void store_fpscr(CPUPPCState *env, uint64_t arg, uint32_t mask)
+{
+    helper_store_fpscr(env, arg, mask);
+}
+
 void helper_float_check_status(CPUPPCState *env)
 {
    if (env->exception_index == POWERPC_EXCP_PROGRAM &&
target-ppc/translate_init.c +1 -1
index 09ad4ba..8511b2f 100644
@@ -7693,7 +7693,7 @@ static int gdb_set_float_reg(CPUPPCState *env, uint8_t *mem_buf, int n)
        return 8;
    }
    if (n == 32) {
-        /* FPSCR not implemented  */
+        helper_store_fpscr(env, ldl_p(mem_buf), 0xffffffff);
        return 4;
    }
    return 0;
Signature · 1 line
1.7.9.5