Skip to contentSkip to conversation

The m68k gdbstub SR reg request doesnt include Condition-Codes

PATCH In review Lucien Murray-Pitts via Qemu-devel 3 participants 3 messages May 26, 2019 – May 27, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 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

---
 target/m68k/gdbstub.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
target/m68k/gdbstub.c +4 -2
index fd2bb46c42..f092044883 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
Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Lucien Murray-Pitts

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

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

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

Quoted 8 lines
target/m68k/gdbstub.c +3 -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: {
+            /* 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)));

I think parenthesis are superfluous.

With that fixed:

Quoted 5 lines
target/m68k/gdbstub.c +1 -0
+        }
          case 17:
              return gdb_get_reg32(mem_buf, env->pc);
          }
#2 lore raw
In reply to Lucien Murray-Pitts via Qemu-devel
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

Subject: [Qemu-devel] [PATCH] The m68k gdbstub SR reg request doesnt include Condition-Codes
Message-id: [email protected]
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
d12cb52 The m68k gdbstub SR reg request doesnt include Condition-Codes

=== OUTPUT BEGIN ===
ERROR: Author email address is mangled by the mailing list #2:
Author: Lucien Murray-Pitts via Qemu-devel <[email protected]>

total: 1 errors, 0 warnings, 12 lines checked

Commit d12cb52d6c7f (The m68k gdbstub SR reg request doesnt include Condition-Codes) has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1

The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]