mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-23 16:08:41 -07:00
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>
This commit is contained in:
parent
b9317a2a69
commit
1b7b26e474
4 changed files with 41 additions and 13 deletions
|
|
@ -28,9 +28,14 @@ int xtensa_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
|
|||
XtensaCPU *cpu = XTENSA_CPU(cs);
|
||||
CPUXtensaState *env = &cpu->env;
|
||||
const XtensaGdbReg *reg = env->config->gdb_regmap.reg + n;
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
int num_regs = env->config->gdb_regmap.num_core_regs;
|
||||
#else
|
||||
int num_regs = env->config->gdb_regmap.num_regs;
|
||||
#endif
|
||||
unsigned i;
|
||||
|
||||
if (n < 0 || n >= env->config->gdb_regmap.num_regs) {
|
||||
if (n < 0 || n >= num_regs) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -81,8 +86,13 @@ int xtensa_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
|
|||
CPUXtensaState *env = &cpu->env;
|
||||
uint32_t tmp;
|
||||
const XtensaGdbReg *reg = env->config->gdb_regmap.reg + n;
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
int num_regs = env->config->gdb_regmap.num_core_regs;
|
||||
#else
|
||||
int num_regs = env->config->gdb_regmap.num_regs;
|
||||
#endif
|
||||
|
||||
if (n < 0 || n >= env->config->gdb_regmap.num_regs) {
|
||||
if (n < 0 || n >= num_regs) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue