提交 4c4c8723 编写于 作者: M Michael Ellerman 提交者: Paul Mackerras

[POWERPC] Prepare for spu disassembly in xmon

In order to do disassembly of spu binaries in xmon, we need to abstract
the disassembly function from ppc_inst_dump.

We do this by making the actual disassembly function a function pointer
that we pass to ppc_inst_dump(). To save updating all the callers, we
turn ppc_inst_dump() into generic_inst_dump() and make ppc_inst_dump()
a wrapper which always uses print_insn_powerpc().

Currently we pass the dialect into print_insn_powerpc(), but we always
pass 0 - so just make it a local.
Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
Signed-off-by: NArnd Bergmann <arnd.bergmann@de.ibm.com>
上级 24a24c85
...@@ -27,14 +27,14 @@ extern void print_address (unsigned long memaddr); ...@@ -27,14 +27,14 @@ extern void print_address (unsigned long memaddr);
/* Print a PowerPC or POWER instruction. */ /* Print a PowerPC or POWER instruction. */
int int
print_insn_powerpc (unsigned long insn, unsigned long memaddr, int dialect) print_insn_powerpc (unsigned long insn, unsigned long memaddr)
{ {
const struct powerpc_opcode *opcode; const struct powerpc_opcode *opcode;
const struct powerpc_opcode *opcode_end; const struct powerpc_opcode *opcode_end;
unsigned long op; unsigned long op;
int dialect;
if (dialect == 0) dialect = PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC | PPC_OPCODE_COMMON
dialect = PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC | PPC_OPCODE_COMMON
| PPC_OPCODE_64 | PPC_OPCODE_POWER4 | PPC_OPCODE_ALTIVEC; | PPC_OPCODE_64 | PPC_OPCODE_POWER4 | PPC_OPCODE_ALTIVEC;
/* Get the major opcode of the instruction. */ /* Get the major opcode of the instruction. */
......
...@@ -154,7 +154,7 @@ static int do_spu_cmd(void); ...@@ -154,7 +154,7 @@ static int do_spu_cmd(void);
int xmon_no_auto_backtrace; int xmon_no_auto_backtrace;
extern int print_insn_powerpc(unsigned long, unsigned long, int); extern int print_insn_powerpc(unsigned long insn, unsigned long memaddr);
extern void xmon_enter(void); extern void xmon_enter(void);
extern void xmon_leave(void); extern void xmon_leave(void);
...@@ -2068,8 +2068,11 @@ prdump(unsigned long adrs, long ndump) ...@@ -2068,8 +2068,11 @@ prdump(unsigned long adrs, long ndump)
} }
} }
typedef int (*instruction_dump_func)(unsigned long inst, unsigned long addr);
int int
ppc_inst_dump(unsigned long adr, long count, int praddr) generic_inst_dump(unsigned long adr, long count, int praddr,
instruction_dump_func dump_func)
{ {
int nr, dotted; int nr, dotted;
unsigned long first_adr; unsigned long first_adr;
...@@ -2099,12 +2102,18 @@ ppc_inst_dump(unsigned long adr, long count, int praddr) ...@@ -2099,12 +2102,18 @@ ppc_inst_dump(unsigned long adr, long count, int praddr)
if (praddr) if (praddr)
printf(REG" %.8x", adr, inst); printf(REG" %.8x", adr, inst);
printf("\t"); printf("\t");
print_insn_powerpc(inst, adr, 0); /* always returns 4 */ dump_func(inst, adr);
printf("\n"); printf("\n");
} }
return adr - first_adr; return adr - first_adr;
} }
int
ppc_inst_dump(unsigned long adr, long count, int praddr)
{
return generic_inst_dump(adr, count, praddr, print_insn_powerpc);
}
void void
print_address(unsigned long addr) print_address(unsigned long addr)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册