From 5b50e790f9e9403d11b4164193b76530ee85a2a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sat, 29 Jun 2013 04:18:45 +0200 Subject: cpu: Introduce CPUClass::gdb_{read,write}_register() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Completes migration of target-specific code to new target-*/gdbstub.c. Acked-by: Michael Walle (for lm32) Acked-by: Max Filippov (for xtensa) Signed-off-by: Andreas Färber --- target-cris/Makefile.objs | 1 + target-cris/cpu-qom.h | 3 +++ target-cris/cpu.c | 2 ++ target-cris/gdbstub.c | 11 +++++++++-- 4 files changed, 15 insertions(+), 2 deletions(-) (limited to 'target-cris') diff --git a/target-cris/Makefile.objs b/target-cris/Makefile.objs index afb87bcc80..7779227fc4 100644 --- a/target-cris/Makefile.objs +++ b/target-cris/Makefile.objs @@ -1,2 +1,3 @@ obj-y += translate.o op_helper.o helper.o cpu.o +obj-y += gdbstub.o obj-$(CONFIG_SOFTMMU) += mmu.o machine.o diff --git a/target-cris/cpu-qom.h b/target-cris/cpu-qom.h index d7baf0746a..3e92ea011d 100644 --- a/target-cris/cpu-qom.h +++ b/target-cris/cpu-qom.h @@ -81,4 +81,7 @@ void cris_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, hwaddr cris_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +int cris_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); +int cris_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); + #endif diff --git a/target-cris/cpu.c b/target-cris/cpu.c index 31eeddf822..8fcc95d994 100644 --- a/target-cris/cpu.c +++ b/target-cris/cpu.c @@ -255,6 +255,8 @@ static void cris_cpu_class_init(ObjectClass *oc, void *data) cc->do_interrupt = cris_cpu_do_interrupt; cc->dump_state = cris_cpu_dump_state; cc->set_pc = cris_cpu_set_pc; + cc->gdb_read_register = cris_cpu_gdb_read_register; + cc->gdb_write_register = cris_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = cris_cpu_get_phys_page_debug; #endif diff --git a/target-cris/gdbstub.c b/target-cris/gdbstub.c index ed23966c91..958a370e06 100644 --- a/target-cris/gdbstub.c +++ b/target-cris/gdbstub.c @@ -17,6 +17,9 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see . */ +#include "config.h" +#include "qemu-common.h" +#include "exec/gdbstub.h" static int read_register_crisv10(CPUCRISState *env, uint8_t *mem_buf, int n) @@ -48,8 +51,10 @@ read_register_crisv10(CPUCRISState *env, uint8_t *mem_buf, int n) return 0; } -static int cpu_gdb_read_register(CPUCRISState *env, uint8_t *mem_buf, int n) +int cris_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n) { + CRISCPU *cpu = CRIS_CPU(cs); + CPUCRISState *env = &cpu->env; uint8_t srs; if (env->pregs[PR_VR] < 32) { @@ -85,8 +90,10 @@ static int cpu_gdb_read_register(CPUCRISState *env, uint8_t *mem_buf, int n) return 0; } -static int cpu_gdb_write_register(CPUCRISState *env, uint8_t *mem_buf, int n) +int cris_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) { + CRISCPU *cpu = CRIS_CPU(cs); + CPUCRISState *env = &cpu->env; uint32_t tmp; if (n > 49) { -- cgit v1.2.1