diff options
author | Max Filippov | 2018-02-04 08:55:06 +0100 |
---|---|---|
committer | Max Filippov | 2018-03-13 19:30:22 +0100 |
commit | 1b7b26e4748580dce3ec671ce7ed3d65a986cf9c (patch) | |
tree | a0864458473d081e4e7e57ea68ffd23c45599801 /target/xtensa/helper.c | |
parent | target/xtensa: mark register windows in the dump (diff) | |
download | qemu-1b7b26e4748580dce3ec671ce7ed3d65a986cf9c.tar.gz qemu-1b7b26e4748580dce3ec671ce7ed3d65a986cf9c.tar.xz qemu-1b7b26e4748580dce3ec671ce7ed3d65a986cf9c.zip |
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.c | 28 |
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) |