Skip to contentSkip to conversation

The m68k gdbstub SR reg request doesnt include Condition-Codes

PATCH Superseded Lucien Murray-Pitts 2 participants 2 messages Jun 9, 2019

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 The m68k gdbstub SR reg request doesnt include Condition-Codes

The register request via gdbstub would return the SR part which contains the Trace/Master/IRQ state flags, but would be missing the CR (Condition Register) state bits.

This fix adds this support by merging them in the m68k specific gdbstub handler m68k_cpu_gdb_read_register for SR register.

---

Notes:
v1->v2
- remove superfluous braces from my additional code
- slightly amended the commit message

 target/m68k/gdbstub.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
target/m68k/gdbstub.c +4 -2
index fd2bb46c42..5e5aef5c0f 100644
@@ -35,8 +35,10 @@ int m68k_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
         return gdb_get_reg32(mem_buf, env->aregs[n - 8]);
     } else {
         switch (n) {
-        case 16:
-            return gdb_get_reg32(mem_buf, env->sr);
+        case 16: {
+            /* SR is made of SR+CCR, CCR is many 1bit flags so uses helper */
+            return gdb_get_reg32(mem_buf, env->sr | cpu_m68k_get_ccr(env));
+        }
         case 17:
             return gdb_get_reg32(mem_buf, env->pc);
         }
Signature · 1 line
2.21.0
#1 lore raw

Le 09/06/2019 à 11:07, Lucien Murray-Pitts a écrit :

Quoted 7 lines

The register request via gdbstub would return the SR part which contains the Trace/Master/IRQ state flags, but would be missing the CR (Condition Register) state bits.

This fix adds this support by merging them in the m68k specific gdbstub handler m68k_cpu_gdb_read_register for SR register.

Quoted 6 lines

---

Notes:
v1->v2
- remove superfluous braces from my additional code

You removed the parentheses.

Quoted 10 lines

- slightly amended the commit message

 target/m68k/gdbstub.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
target/m68k/gdbstub.c +0 -0
index fd2bb46c42..5e5aef5c0f 100644

target/m68k/gdbstub.c int m68k_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n) · line 38

Quoted 6 lines
target/m68k/gdbstub.c +1 -2
@@ -35,8 +35,10 @@ int m68k_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
         return gdb_get_reg32(mem_buf, env->aregs[n - 8]);
     } else {
         switch (n) {
-        case 16:
-            return gdb_get_reg32(mem_buf, env->sr);
+        case 16: {

You can also remove the braces.

target/m68k/gdbstub.c int m68k_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n) · line 44

Quoted 7 lines
target/m68k/gdbstub.c +3 -0
+            /* SR is made of SR+CCR, CCR is many 1bit flags so uses helper */
+            return gdb_get_reg32(mem_buf, env->sr | cpu_m68k_get_ccr(env));
+        }
         case 17:
             return gdb_get_reg32(mem_buf, env->pc);
         }

Thanks,
Laurent