[PATCH v2 01/22] sim/erc32: Disassembly in stand-alone mode did not work.

Jiri Gaisler
2015-02-19T22:32:23Z

The API to print_insn_sparc() has changed over the years ...

* func.c (print_insn_sparc_sis) Add helper function for disassembly.
(disp_ctrl) Use helper function.
---
sim/erc32/func.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/sim/erc32/func.c b/sim/erc32/func.c
index d001c58..e6744ee 100644
--- a/sim/erc32/func.c
+++ b/sim/erc32/func.c
@@ -759,6 +759,17 @@ disp_regs(sregs,cwp)
}
}

+static void print_insn_sparc_sis(uint32 addr, struct disassemble_info *info)
+{
+ unsigned char i[4];
+
+ sis_memory_read(addr, i, 4);
+ dinfo.buffer_vma = addr;
+ dinfo.buffer_length = 4;
+ dinfo.buffer = i;
+ print_insn_sparc(addr, info);
+}
+
static void
disp_ctrl(sregs)
struct pstate *sregs;
@@ -770,10 +781,10 @@ disp_ctrl(sregs)
sregs->psr, sregs->wim, sregs->tbr, sregs->y);
sis_memory_read(sregs->pc, i, 4);
printf("\n pc: %08X = %02X%02X%02X%02X ", sregs->pc,i[0],i[1],i[2],i[3]);
- print_insn_sparc(sregs->pc, &dinfo);
+ print_insn_sparc_sis(sregs->pc, &dinfo);
sis_memory_read(sregs->npc, i, 4);
printf("\n npc: %08X = %02X%02X%02X%02X ",sregs->npc,i[0],i[1],i[2],i[3]);
- print_insn_sparc(sregs->npc, &dinfo);
+ print_insn_sparc_sis(sregs->npc, &dinfo);
if (sregs->err_mode)
printf("\n IU in error mode");
printf("\n\n");
@@ -821,7 +832,7 @@ dis_mem(addr, len, info)
for (i = addr & -3; i < ((addr & -3) + (len << 2)); i += 4) {
sis_memory_read(i, data, 4);
printf(" %08x %02x%02x%02x%02x ", i, data[0],data[1],data[2],data[3]);
- print_insn_sparc(i, info);
+ print_insn_sparc_sis(i, info);
if (i >= 0xfffffffc) break;
printf("\n");
}
--
2.1.0