Skip to contentSkip to conversation

target/xtensa: gdbstub fixes

PATCH New Max Filippov 1 participant 3 messages Aug 16, 2018

lore
Share & tools
lore
#0 lore raw

cover target/xtensa: gdbstub fixes

Hello,

this series fixes communication between xtensa gdb and QEMU gdbstub in the presence of TIE states mapped to user registers in the core configuration and does a cleanup on top of it.

Max Filippov (2):
target/xtensa: fix gdbstub register counts target/xtensa: clean up gdbstub register handling

 target/xtensa/cpu.h     |  2 ++
 target/xtensa/gdbstub.c | 60 +++++++++++++++++++++++++++++++++++++++----------
 target/xtensa/helper.c  | 10 +--------
 3 files changed, 51 insertions(+), 21 deletions(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/2 target/xtensa: fix gdbstub register counts

This fixes communication with gdb in the presence of type-5 (TIE state mapped on user registers) and type-7 (special case of masked registers) registers in the xtensa core config.

---
 target/xtensa/helper.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
target/xtensa/helper.c +3 -1
index c9a613270036..efb3cef12813 100644
@@ -100,7 +100,9 @@ void xtensa_finalize_config(XtensaConfig *config)
         unsigned n_core_regs = 0;
 
         for (i = 0; config->gdb_regmap.reg[i].targno >= 0; ++i) {
-            if (config->gdb_regmap.reg[i].type != 6) {
+            if (config->gdb_regmap.reg[i].type != 5 &&
+                config->gdb_regmap.reg[i].type != 6 &&
+                config->gdb_regmap.reg[i].type != 7) {
                 ++n_regs;
                 if ((config->gdb_regmap.reg[i].flags & 0x1) == 0) {
                     ++n_core_regs;
Signature · 1 line
2.11.0
#2 lore raw

PATCH 2/2 target/xtensa: clean up gdbstub register handling

In reply to Max Filippov

- move register counting to xtensa/gdbstub.c
- add symbolic names for register types and flags from GDB and use them in register counting and access functions.

---
 target/xtensa/cpu.h     |  2 ++
 target/xtensa/gdbstub.c | 60 +++++++++++++++++++++++++++++++++++++++----------
 target/xtensa/helper.c  | 12 +---------
 3 files changed, 51 insertions(+), 23 deletions(-)
target/xtensa/cpu.h +2 -0
index 51b455146494..7472cf3ca32a 100644
@@ -503,6 +503,8 @@ void xtensa_cpu_do_unassigned_access(CPUState *cpu, hwaddr addr,
 void xtensa_cpu_dump_state(CPUState *cpu, FILE *f,
                            fprintf_function cpu_fprintf, int flags);
 hwaddr xtensa_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
+void xtensa_count_regs(const XtensaConfig *config,
+                       unsigned *n_regs, unsigned *n_core_regs);
 int xtensa_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
 int xtensa_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
 void xtensa_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
target/xtensa/gdbstub.c +48 -12

113 lines not on this page · raw message

target/xtensa/helper.c +1 -11
index efb3cef12813..f74636f67854 100644
@@ -95,20 +95,10 @@ void xtensa_finalize_config(XtensaConfig *config)
 
     if (config->gdb_regmap.num_regs == 0 ||
         config->gdb_regmap.num_core_regs == 0) {
-        unsigned i;
         unsigned n_regs = 0;
         unsigned n_core_regs = 0;
 
-        for (i = 0; config->gdb_regmap.reg[i].targno >= 0; ++i) {
-            if (config->gdb_regmap.reg[i].type != 5 &&
-                config->gdb_regmap.reg[i].type != 6 &&
-                config->gdb_regmap.reg[i].type != 7) {
-                ++n_regs;
-                if ((config->gdb_regmap.reg[i].flags & 0x1) == 0) {
-                    ++n_core_regs;
-                }
-            }
-        }
+        xtensa_count_regs(config, &n_regs, &n_core_regs);
         if (config->gdb_regmap.num_regs == 0) {
             config->gdb_regmap.num_regs = n_regs;
         }
Signature · 1 line
2.11.0