summaryrefslogtreecommitdiff
path: root/gdbstub.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2006-04-27 21:07:38 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2006-04-27 21:07:38 +0000
commitfdf9b3e831e8e6b5ceb2a44c742da7d1ab558242 (patch)
treeba55ae7076148e88f174b9ce8928f12551583941 /gdbstub.c
parent66a93e0f47fa9869178008c7bc38d66a7c5e45f4 (diff)
downloadqemu-fdf9b3e831e8e6b5ceb2a44c742da7d1ab558242.tar.gz
qemu-fdf9b3e831e8e6b5ceb2a44c742da7d1ab558242.tar.bz2
qemu-fdf9b3e831e8e6b5ceb2a44c742da7d1ab558242.zip
sh4 target (Samuel Tardieu)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1861 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'gdbstub.c')
-rw-r--r--gdbstub.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/gdbstub.c b/gdbstub.c
index 8157160fd1..bca9b1e2a6 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -487,6 +487,45 @@ static void cpu_gdb_write_registers(CPUState *env, uint8_t *mem_buf, int size)
env->PC = tswapl(*(uint32_t *)ptr);
ptr += 4;
}
+#elif defined (TARGET_SH4)
+static int cpu_gdb_read_registers(CPUState *env, uint8_t *mem_buf)
+{
+ uint32_t *ptr = (uint32_t *)mem_buf;
+ int i;
+
+#define SAVE(x) *ptr++=tswapl(x)
+ for (i = 0; i < 16; i++) SAVE(env->gregs[i]);
+ SAVE (env->pc);
+ SAVE (env->pr);
+ SAVE (env->gbr);
+ SAVE (env->vbr);
+ SAVE (env->mach);
+ SAVE (env->macl);
+ SAVE (env->sr);
+ SAVE (0); /* TICKS */
+ SAVE (0); /* STALLS */
+ SAVE (0); /* CYCLES */
+ SAVE (0); /* INSTS */
+ SAVE (0); /* PLR */
+
+ return ((uint8_t *)ptr - mem_buf);
+}
+
+static void cpu_gdb_write_registers(CPUState *env, uint8_t *mem_buf, int size)
+{
+ uint32_t *ptr = (uint32_t *)mem_buf;
+ int i;
+
+#define LOAD(x) (x)=*ptr++;
+ for (i = 0; i < 16; i++) LOAD(env->gregs[i]);
+ LOAD (env->pc);
+ LOAD (env->pr);
+ LOAD (env->gbr);
+ LOAD (env->vbr);
+ LOAD (env->mach);
+ LOAD (env->macl);
+ LOAD (env->sr);
+}
#else
static int cpu_gdb_read_registers(CPUState *env, uint8_t *mem_buf)
{
@@ -531,6 +570,8 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf)
env->npc = addr + 4;
#elif defined (TARGET_ARM)
env->regs[15] = addr;
+#elif defined (TARGET_SH4)
+ env->pc = addr;
#endif
}
#ifdef CONFIG_USER_ONLY
@@ -551,6 +592,8 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf)
env->npc = addr + 4;
#elif defined (TARGET_ARM)
env->regs[15] = addr;
+#elif defined (TARGET_SH4)
+ env->pc = addr;
#endif
}
cpu_single_step(env, 1);