Commit d74d6a99a05e07771acc5f6b91db04be4c1f007f
1 parent
6a8b1ae2
microblaze: Add GDB stub support.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Showing
1 changed file
with
32 additions
and
0 deletions
gdbstub.c
@@ -1156,6 +1156,36 @@ static int cpu_gdb_write_register(CPUState *env, uint8_t *mem_buf, int n) | @@ -1156,6 +1156,36 @@ static int cpu_gdb_write_register(CPUState *env, uint8_t *mem_buf, int n) | ||
1156 | 1156 | ||
1157 | return 4; | 1157 | return 4; |
1158 | } | 1158 | } |
1159 | +#elif defined (TARGET_MICROBLAZE) | ||
1160 | + | ||
1161 | +#define NUM_CORE_REGS (32 + 5) | ||
1162 | + | ||
1163 | +static int cpu_gdb_read_register(CPUState *env, uint8_t *mem_buf, int n) | ||
1164 | +{ | ||
1165 | + if (n < 32) { | ||
1166 | + GET_REG32(env->regs[n]); | ||
1167 | + } else { | ||
1168 | + GET_REG32(env->sregs[n - 32]); | ||
1169 | + } | ||
1170 | + return 0; | ||
1171 | +} | ||
1172 | + | ||
1173 | +static int cpu_gdb_write_register(CPUState *env, uint8_t *mem_buf, int n) | ||
1174 | +{ | ||
1175 | + uint32_t tmp; | ||
1176 | + | ||
1177 | + if (n > NUM_CORE_REGS) | ||
1178 | + return 0; | ||
1179 | + | ||
1180 | + tmp = ldl_p(mem_buf); | ||
1181 | + | ||
1182 | + if (n < 32) { | ||
1183 | + env->regs[n] = tmp; | ||
1184 | + } else { | ||
1185 | + env->sregs[n - 32] = tmp; | ||
1186 | + } | ||
1187 | + return 4; | ||
1188 | +} | ||
1159 | #elif defined (TARGET_CRIS) | 1189 | #elif defined (TARGET_CRIS) |
1160 | 1190 | ||
1161 | #define NUM_CORE_REGS 49 | 1191 | #define NUM_CORE_REGS 49 |
@@ -1528,6 +1558,8 @@ static void gdb_set_cpu_pc(GDBState *s, target_ulong pc) | @@ -1528,6 +1558,8 @@ static void gdb_set_cpu_pc(GDBState *s, target_ulong pc) | ||
1528 | s->c_cpu->pc = pc; | 1558 | s->c_cpu->pc = pc; |
1529 | #elif defined (TARGET_MIPS) | 1559 | #elif defined (TARGET_MIPS) |
1530 | s->c_cpu->active_tc.PC = pc; | 1560 | s->c_cpu->active_tc.PC = pc; |
1561 | +#elif defined (TARGET_MICROBLAZE) | ||
1562 | + s->c_cpu->sregs[SR_PC] = pc; | ||
1531 | #elif defined (TARGET_CRIS) | 1563 | #elif defined (TARGET_CRIS) |
1532 | s->c_cpu->pc = pc; | 1564 | s->c_cpu->pc = pc; |
1533 | #elif defined (TARGET_ALPHA) | 1565 | #elif defined (TARGET_ALPHA) |