[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v8 13/16] target-or32: Add gdb stub support
From: |
Jia Liu |
Subject: |
[Qemu-devel] [PATCH v8 13/16] target-or32: Add gdb stub support |
Date: |
Sun, 1 Jul 2012 10:45:27 +0800 |
Add OpenRISC gdb stub support.
Signed-off-by: Jia Liu <address@hidden>
---
gdbstub.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/gdbstub.c b/gdbstub.c
index 08cf864..5d37dd9 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1155,6 +1155,68 @@ static int cpu_gdb_write_register(CPUMIPSState *env,
uint8_t *mem_buf, int n)
return sizeof(target_ulong);
}
+#elif defined(TARGET_OPENRISC)
+
+#define NUM_CORE_REGS (32 + 3)
+
+static int cpu_gdb_read_register(CPUOpenRISCState *env, uint8_t *mem_buf, int
n)
+{
+ if (n < 32) {
+ GET_REG32(env->gpr[n]);
+ } else {
+ switch (n) {
+ case 32: /* PPC */
+ GET_REG32(env->ppc);
+ break;
+
+ case 33: /* NPC */
+ GET_REG32(env->npc);
+ break;
+
+ case 34: /* SR */
+ GET_REG32(env->sr);
+ break;
+
+ default:
+ break;
+ }
+ }
+ return 0;
+}
+
+static int cpu_gdb_write_register(CPUOpenRISCState *env,
+ uint8_t *mem_buf, int n)
+{
+ uint32_t tmp;
+
+ if (n > NUM_CORE_REGS) {
+ return 0;
+ }
+
+ tmp = ldl_p(mem_buf);
+
+ if (n < 32) {
+ env->gpr[n] = tmp;
+ } else {
+ switch (n) {
+ case 32: /* PPC */
+ env->ppc = tmp;
+ break;
+
+ case 33: /* NPC */
+ env->npc = tmp;
+ break;
+
+ case 34: /* SR */
+ env->sr = tmp;
+ break;
+
+ default:
+ break;
+ }
+ }
+ return 4;
+}
#elif defined (TARGET_SH4)
/* Hint: Use "set architecture sh4" in GDB to see fpu registers */
@@ -1924,6 +1986,8 @@ static void gdb_set_cpu_pc(GDBState *s, target_ulong pc)
}
#elif defined (TARGET_MICROBLAZE)
s->c_cpu->sregs[SR_PC] = pc;
+#elif defined(TARGET_OPENRISC)
+ s->c_cpu->pc = pc;
#elif defined (TARGET_CRIS)
s->c_cpu->pc = pc;
#elif defined (TARGET_ALPHA)
--
1.7.9.5
- [Qemu-devel] [PATCH v8 01/16] target-or32: Add target stubs and QOM cpu, (continued)
- [Qemu-devel] [PATCH v8 01/16] target-or32: Add target stubs and QOM cpu, Jia Liu, 2012/06/30
- [Qemu-devel] [PATCH v8 02/16] target-or32: Add target machine, Jia Liu, 2012/06/30
- [Qemu-devel] [PATCH v8 03/16] target-or32: Add MMU support, Jia Liu, 2012/06/30
- [Qemu-devel] [PATCH v8 04/16] target-or32: Add interrupt support, Jia Liu, 2012/06/30
- [Qemu-devel] [PATCH v8 05/16] target-or32: Add exception support, Jia Liu, 2012/06/30
- [Qemu-devel] [PATCH v8 06/16] target-or32: Add int instruction helpers, Jia Liu, 2012/06/30
- [Qemu-devel] [PATCH v8 08/16] target-or32: Add instruction translation, Jia Liu, 2012/06/30
- [Qemu-devel] [PATCH v8 09/16] target-or32: Add PIC support, Jia Liu, 2012/06/30
- [Qemu-devel] [PATCH v8 11/16] target-or32: Add a IIS dummy board, Jia Liu, 2012/06/30
- [Qemu-devel] [PATCH v8 12/16] target-or32: Add system instructions, Jia Liu, 2012/06/30
- [Qemu-devel] [PATCH v8 13/16] target-or32: Add gdb stub support,
Jia Liu <=
- [Qemu-devel] [PATCH v8 14/16] target-or32: Add linux syscall, signal and termbits, Jia Liu, 2012/06/30
- [Qemu-devel] [PATCH v8 15/16] target-or32: Add linux user support, Jia Liu, 2012/06/30
- [Qemu-devel] [PATCH v8 16/16] target-or32: Add testcases, Jia Liu, 2012/06/30
- [Qemu-devel] [PATCH v8 07/16] target-or32: Add float instruction helpers, Jia Liu, 2012/06/30
- [Qemu-devel] [PATCH v8 10/16] target-or32: Add timer support, Jia Liu, 2012/06/30