* [Qemu-devel] [PATCH 0/2] target/xtensa fixes for 3.1
@ 2018-11-20 2:39 Max Filippov
2018-11-20 2:39 ` [Qemu-devel] [PATCH 1/2] target/xtensa: gdbstub fix register counting Max Filippov
2018-11-20 2:39 ` [Qemu-devel] [PATCH 2/2] target/xtensa: drop num_[core_]regs from dc232b/dc233c configs Max Filippov
0 siblings, 2 replies; 3+ messages in thread
From: Max Filippov @ 2018-11-20 2:39 UTC (permalink / raw)
To: qemu-devel; +Cc: Max Filippov
Hello,
the following two patches fix gdbserver register counting for xtensa-softmmu
and xtensa-linux and drops explicit register counters from DC232B and DC233C
core configurations.
Max Filippov (2):
target/xtensa: gdbstub fix register counting
target/xtensa: drop num_[core_]regs from dc232b/dc233c configs
target/xtensa/core-dc232b.c | 2 --
target/xtensa/core-dc232b/gdb-config.inc.c | 1 +
target/xtensa/core-dc233c.c | 2 --
target/xtensa/core-dc233c/gdb-config.inc.c | 1 +
target/xtensa/gdbstub.c | 11 ++++++++---
5 files changed, 10 insertions(+), 7 deletions(-)
--
2.11.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] [PATCH 1/2] target/xtensa: gdbstub fix register counting
2018-11-20 2:39 [Qemu-devel] [PATCH 0/2] target/xtensa fixes for 3.1 Max Filippov
@ 2018-11-20 2:39 ` Max Filippov
2018-11-20 2:39 ` [Qemu-devel] [PATCH 2/2] target/xtensa: drop num_[core_]regs from dc232b/dc233c configs Max Filippov
1 sibling, 0 replies; 3+ messages in thread
From: Max Filippov @ 2018-11-20 2:39 UTC (permalink / raw)
To: qemu-devel; +Cc: Max Filippov
In order to communicate correctly with gdb xtensa gdbstub must provide
expected number of registers in 'g' packet response. xtensa-elf-gdb
expects both nonprivileged and privileged registers. xtensa-linux-gdb
only expects nonprivileged registers. gdb only counts one contiguous
stretch of registers, do the same for the core registers in the
xtensa_count_regs.
With this change qemu-system-xtensa is able to communicate with all
xtensa-elf-gdb versions (versions prior to 8.2 require overlay fixup),
and qemu-xtensa is able to communicate with all xtensa-linux-gdb
versions, except 8.2.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
target/xtensa/gdbstub.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/target/xtensa/gdbstub.c b/target/xtensa/gdbstub.c
index c9450914c72d..d43bb190c614 100644
--- a/target/xtensa/gdbstub.c
+++ b/target/xtensa/gdbstub.c
@@ -45,15 +45,20 @@ void xtensa_count_regs(const XtensaConfig *config,
unsigned *n_regs, unsigned *n_core_regs)
{
unsigned i;
+ bool count_core_regs = true;
for (i = 0; config->gdb_regmap.reg[i].targno >= 0; ++i) {
if (config->gdb_regmap.reg[i].type != xtRegisterTypeTieState &&
config->gdb_regmap.reg[i].type != xtRegisterTypeMapped &&
config->gdb_regmap.reg[i].type != xtRegisterTypeUnmapped) {
++*n_regs;
- if ((config->gdb_regmap.reg[i].flags &
- XTENSA_REGISTER_FLAGS_PRIVILEGED) == 0) {
- ++*n_core_regs;
+ if (count_core_regs) {
+ if ((config->gdb_regmap.reg[i].flags &
+ XTENSA_REGISTER_FLAGS_PRIVILEGED) == 0) {
+ ++*n_core_regs;
+ } else {
+ count_core_regs = false;
+ }
}
}
}
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Qemu-devel] [PATCH 2/2] target/xtensa: drop num_[core_]regs from dc232b/dc233c configs
2018-11-20 2:39 [Qemu-devel] [PATCH 0/2] target/xtensa fixes for 3.1 Max Filippov
2018-11-20 2:39 ` [Qemu-devel] [PATCH 1/2] target/xtensa: gdbstub fix register counting Max Filippov
@ 2018-11-20 2:39 ` Max Filippov
1 sibling, 0 replies; 3+ messages in thread
From: Max Filippov @ 2018-11-20 2:39 UTC (permalink / raw)
To: qemu-devel; +Cc: Max Filippov
Now that xtensa_count_regs does the right thing, remove manual
initialization of these fields from the affected configurations and let
xtensa_finalize_config initialize them. Add XTREG_END to terminate
register lists.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
target/xtensa/core-dc232b.c | 2 --
target/xtensa/core-dc232b/gdb-config.inc.c | 1 +
target/xtensa/core-dc233c.c | 2 --
target/xtensa/core-dc233c/gdb-config.inc.c | 1 +
4 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/target/xtensa/core-dc232b.c b/target/xtensa/core-dc232b.c
index 71313378409e..7851bcb63687 100644
--- a/target/xtensa/core-dc232b.c
+++ b/target/xtensa/core-dc232b.c
@@ -40,8 +40,6 @@
static XtensaConfig dc232b __attribute__((unused)) = {
.name = "dc232b",
.gdb_regmap = {
- .num_regs = 120,
- .num_core_regs = 52,
.reg = {
#include "core-dc232b/gdb-config.inc.c"
}
diff --git a/target/xtensa/core-dc232b/gdb-config.inc.c b/target/xtensa/core-dc232b/gdb-config.inc.c
index 13aba5edecd6..d87168628be8 100644
--- a/target/xtensa/core-dc232b/gdb-config.inc.c
+++ b/target/xtensa/core-dc232b/gdb-config.inc.c
@@ -259,3 +259,4 @@
0, 0, 0, 0, 0, 0)
XTREG(119, 476, 32, 4, 4, 0x000f, 0x0006, -2, 8, 0x0100, a15,
0, 0, 0, 0, 0, 0)
+ XTREG_END
diff --git a/target/xtensa/core-dc233c.c b/target/xtensa/core-dc233c.c
index d701e3f5de07..8853bfd4d08f 100644
--- a/target/xtensa/core-dc233c.c
+++ b/target/xtensa/core-dc233c.c
@@ -40,8 +40,6 @@
static XtensaConfig dc233c __attribute__((unused)) = {
.name = "dc233c",
.gdb_regmap = {
- .num_regs = 121,
- .num_core_regs = 52,
.reg = {
#include "core-dc233c/gdb-config.inc.c"
}
diff --git a/target/xtensa/core-dc233c/gdb-config.inc.c b/target/xtensa/core-dc233c/gdb-config.inc.c
index b632341b28ec..7e8963227fc0 100644
--- a/target/xtensa/core-dc233c/gdb-config.inc.c
+++ b/target/xtensa/core-dc233c/gdb-config.inc.c
@@ -143,3 +143,4 @@ XTREG(117, 468, 32, 4, 4, 0x000c, 0x0006, -2, 8, 0x0100, a12, 0, 0, 0, 0
XTREG(118, 472, 32, 4, 4, 0x000d, 0x0006, -2, 8, 0x0100, a13, 0, 0, 0, 0, 0, 0)
XTREG(119, 476, 32, 4, 4, 0x000e, 0x0006, -2, 8, 0x0100, a14, 0, 0, 0, 0, 0, 0)
XTREG(120, 480, 32, 4, 4, 0x000f, 0x0006, -2, 8, 0x0100, a15, 0, 0, 0, 0, 0, 0)
+XTREG_END
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-11-20 2:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-20 2:39 [Qemu-devel] [PATCH 0/2] target/xtensa fixes for 3.1 Max Filippov
2018-11-20 2:39 ` [Qemu-devel] [PATCH 1/2] target/xtensa: gdbstub fix register counting Max Filippov
2018-11-20 2:39 ` [Qemu-devel] [PATCH 2/2] target/xtensa: drop num_[core_]regs from dc232b/dc233c configs Max Filippov
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).