Permalink
Browse files

target-rl78: Dump GPR banks

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
  • Loading branch information...
1 parent ef963db commit db1fcd0794ff4f9901cb1d45979a9439c6da2064 @afaerber committed Nov 28, 2011
Showing with 26 additions and 0 deletions.
  1. +26 −0 target-78k0/translate.c
View
@@ -34,6 +34,9 @@ static TCGv_i32 cpu_es;
static TCGv_i32 cpu_cs;
#endif
+static const char* gpr8_names[] = { "X", "A", "C", "B", "E", "D", "L", "H" };
+static const char* gpr16_names[] = { "AX", "BC", "DE", "HL" };
+
#include "helper.h"
#define GEN_HELPER 1
#include "helper.h"
@@ -77,6 +80,8 @@ void cpu_rl78_translate_init(void)
#include "helper.h"
}
+#define GPR_START 0xffee0
+
enum PSWBitShifts {
PSW_CY_SHIFT = 0,
PSW_ISP0_SHIFT = 1,
@@ -333,6 +338,7 @@ void rl78_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
int flags)
{
RL78CPU *cpu = RL78_CPU(cs);
+ int i, j;
cpu_fprintf(f, "PC %05" PRIx32 "\n\n", cpu->env.pc);
cpu_fprintf(f, "SP %04" PRIx32 "\n", cpu->env.sp);
@@ -341,4 +347,24 @@ void rl78_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
cpu_fprintf(f, "ES %02" PRIx32 "\n", cpu->env.es);
cpu_fprintf(f, "CS %02" PRIx32 "\n", cpu->env.cs);
#endif
+
+ cpu_fprintf(f, "\n");
+ for (i = 0; i < 4; i++) {
+ cpu_fprintf(f, "BANK%d ", i);
+ }
+ cpu_fprintf(f, "\n");
+ for (i = 0; i < 8; i++) {
+ for (j = 0; j < 4; j++) {
+ hwaddr bank_addr = GPR_START + (3 - j) * 8;
+ if ((i % 2) == 0) {
+ cpu_fprintf(f, " %s %04" PRIx16 " %s %02" PRIx8 " ",
+ gpr16_names[i / 2], lduw_phys(bank_addr + i),
+ gpr8_names[i], ldub_phys(bank_addr + i));
+ } else {
+ cpu_fprintf(f, " %s %02" PRIx8 " ",
+ gpr8_names[i], ldub_phys(bank_addr + i));
+ }
+ }
+ cpu_fprintf(f, "\n");
+ }
}

0 comments on commit db1fcd0

Please sign in to comment.