summaryrefslogtreecommitdiff
path: root/target/xtensa/helper.c
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2018-02-03 23:55:06 -0800
committerMax Filippov <jcmvbkbc@gmail.com>2018-03-13 11:30:22 -0700
commit1b7b26e4748580dce3ec671ce7ed3d65a986cf9c (patch)
treea0864458473d081e4e7e57ea68ffd23c45599801 /target/xtensa/helper.c
parentb9317a2a69ac78f79ee4965037c8eaa407ed0724 (diff)
downloadqemu-1b7b26e4748580dce3ec671ce7ed3d65a986cf9c.tar.gz
target/xtensa: use correct number of registers in gdbstub
System emulation should provide access to all registers, userspace emulation should only provide access to unprivileged registers. Record register flags from GDB register map definition, calculate both num_regs and num_core_regs if either is zero. Use num_regs in system emulation, num_core_regs in userspace emulation gdbstub. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'target/xtensa/helper.c')
-rw-r--r--target/xtensa/helper.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c
index 5009fecedc..34885038d5 100644
--- a/target/xtensa/helper.c
+++ b/target/xtensa/helper.c
@@ -88,19 +88,31 @@ static void init_libisa(XtensaConfig *config)
void xtensa_finalize_config(XtensaConfig *config)
{
- unsigned i, n = 0;
-
if (config->isa_internal) {
init_libisa(config);
}
- if (config->gdb_regmap.num_regs) {
- return;
- }
- for (i = 0; config->gdb_regmap.reg[i].targno >= 0; ++i) {
- n += (config->gdb_regmap.reg[i].type != 6);
+ 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 != 6) {
+ ++n_regs;
+ if ((config->gdb_regmap.reg[i].flags & 0x1) == 0) {
+ ++n_core_regs;
+ }
+ }
+ }
+ if (config->gdb_regmap.num_regs == 0) {
+ config->gdb_regmap.num_regs = n_regs;
+ }
+ if (config->gdb_regmap.num_core_regs == 0) {
+ config->gdb_regmap.num_core_regs = n_core_regs;
+ }
}
- config->gdb_regmap.num_regs = n;
}
void xtensa_register_core(XtensaConfigList *node)