diff options
author | Andreas Färber <afaerber@suse.de> | 2013-06-27 18:25:36 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-07-23 02:41:33 +0200 |
commit | 385b9f0e4d8c60037c937edd7a3735fff7570429 (patch) | |
tree | 52c9757e4442c6e094c699804bf907dad5524955 | |
parent | db6b81d43693cec86d62df79dd7402fc045427ed (diff) |
gdbstub: Change gdb_{read,write}_register() argument to CPUState
Use CPUState::env_ptr for now.
Prepares for changing GDBState::g_cpu to CPUState.
Signed-off-by: Andreas Färber <afaerber@suse.de>
-rw-r--r-- | gdbstub.c | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -1866,8 +1866,9 @@ static const char *get_feature_xml(const char *p, const char **newp) } #endif -static int gdb_read_register(CPUArchState *env, uint8_t *mem_buf, int reg) +static int gdb_read_register(CPUState *cpu, uint8_t *mem_buf, int reg) { + CPUArchState *env = cpu->env_ptr; GDBRegisterState *r; if (reg < NUM_CORE_REGS) @@ -1881,8 +1882,9 @@ static int gdb_read_register(CPUArchState *env, uint8_t *mem_buf, int reg) return 0; } -static int gdb_write_register(CPUArchState *env, uint8_t *mem_buf, int reg) +static int gdb_write_register(CPUState *cpu, uint8_t *mem_buf, int reg) { + CPUArchState *env = cpu->env_ptr; GDBRegisterState *r; if (reg < NUM_CORE_REGS) @@ -2220,7 +2222,8 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) env = s->g_cpu; len = 0; for (addr = 0; addr < num_g_regs; addr++) { - reg_size = gdb_read_register(s->g_cpu, mem_buf + len, addr); + reg_size = gdb_read_register(ENV_GET_CPU(s->g_cpu), + mem_buf + len, addr); len += reg_size; } memtohex(buf, mem_buf, len); @@ -2233,7 +2236,8 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) len = strlen(p) / 2; hextomem((uint8_t *)registers, p, len); for (addr = 0; addr < num_g_regs && len > 0; addr++) { - reg_size = gdb_write_register(s->g_cpu, registers, addr); + reg_size = gdb_write_register(ENV_GET_CPU(s->g_cpu), registers, + addr); len -= reg_size; registers += reg_size; } @@ -2272,7 +2276,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) if (!gdb_has_xml) goto unknown_command; addr = strtoull(p, (char **)&p, 16); - reg_size = gdb_read_register(s->g_cpu, mem_buf, addr); + reg_size = gdb_read_register(ENV_GET_CPU(s->g_cpu), mem_buf, addr); if (reg_size) { memtohex(buf, mem_buf, reg_size); put_packet(s, buf); @@ -2288,7 +2292,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) p++; reg_size = strlen(p) / 2; hextomem(mem_buf, p, reg_size); - gdb_write_register(s->g_cpu, mem_buf, addr); + gdb_write_register(ENV_GET_CPU(s->g_cpu), mem_buf, addr); put_packet(s, "OK"); break; case 'Z': |