aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-07-07 14:39:41 +0200
committerAndreas Färber <afaerber@suse.de>2013-07-27 00:04:17 +0200
commit90431220be42d773084d88635961a45febb01c5d (patch)
treede54385dcc9502b3b0ca9483bfe41d61ccd38a95
parent5b50e790f9e9403d11b4164193b76530ee85a2a1 (diff)
target-cris: Factor out CPUClass::gdb_read_register() hook for v10
Signed-off-by: Andreas Färber <afaerber@suse.de>
-rw-r--r--target-cris/cpu-qom.h1
-rw-r--r--target-cris/cpu.c4
-rw-r--r--target-cris/gdbstub.c10
3 files changed, 9 insertions, 6 deletions
diff --git a/target-cris/cpu-qom.h b/target-cris/cpu-qom.h
index 3e92ea011d..75593667d6 100644
--- a/target-cris/cpu-qom.h
+++ b/target-cris/cpu-qom.h
@@ -81,6 +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 crisv10_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
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);
diff --git a/target-cris/cpu.c b/target-cris/cpu.c
index 8fcc95d994..45f2d6bacf 100644
--- a/target-cris/cpu.c
+++ b/target-cris/cpu.c
@@ -175,6 +175,7 @@ static void crisv8_cpu_class_init(ObjectClass *oc, void *data)
ccc->vr = 8;
cc->do_interrupt = crisv10_cpu_do_interrupt;
+ cc->gdb_read_register = crisv10_cpu_gdb_read_register;
}
static void crisv9_cpu_class_init(ObjectClass *oc, void *data)
@@ -184,6 +185,7 @@ static void crisv9_cpu_class_init(ObjectClass *oc, void *data)
ccc->vr = 9;
cc->do_interrupt = crisv10_cpu_do_interrupt;
+ cc->gdb_read_register = crisv10_cpu_gdb_read_register;
}
static void crisv10_cpu_class_init(ObjectClass *oc, void *data)
@@ -193,6 +195,7 @@ static void crisv10_cpu_class_init(ObjectClass *oc, void *data)
ccc->vr = 10;
cc->do_interrupt = crisv10_cpu_do_interrupt;
+ cc->gdb_read_register = crisv10_cpu_gdb_read_register;
}
static void crisv11_cpu_class_init(ObjectClass *oc, void *data)
@@ -202,6 +205,7 @@ static void crisv11_cpu_class_init(ObjectClass *oc, void *data)
ccc->vr = 11;
cc->do_interrupt = crisv10_cpu_do_interrupt;
+ cc->gdb_read_register = crisv10_cpu_gdb_read_register;
}
static void crisv32_cpu_class_init(ObjectClass *oc, void *data)
diff --git a/target-cris/gdbstub.c b/target-cris/gdbstub.c
index 958a370e06..5db3683ab6 100644
--- a/target-cris/gdbstub.c
+++ b/target-cris/gdbstub.c
@@ -21,9 +21,11 @@
#include "qemu-common.h"
#include "exec/gdbstub.h"
-static int
-read_register_crisv10(CPUCRISState *env, uint8_t *mem_buf, int n)
+int crisv10_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
{
+ CRISCPU *cpu = CRIS_CPU(cs);
+ CPUCRISState *env = &cpu->env;
+
if (n < 15) {
return gdb_get_reg32(mem_buf, env->regs[n]);
}
@@ -57,10 +59,6 @@ int cris_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
CPUCRISState *env = &cpu->env;
uint8_t srs;
- if (env->pregs[PR_VR] < 32) {
- return read_register_crisv10(env, mem_buf, n);
- }
-
srs = env->pregs[PR_SRS];
if (n < 16) {
return gdb_get_reg32(mem_buf, env->regs[n]);