aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/xmon/xmon.c
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2006-11-22 18:46:44 -0500
committerPaul Mackerras <paulus@samba.org>2006-12-04 04:40:31 -0500
commitaf89fb8041562508895c8f3ba04790d7c2f4338c (patch)
tree5b1bdbd2769400b0506a8fa4be64e3fd1d7fed9b /arch/powerpc/xmon/xmon.c
parentae06e374c15c5d62e08c19c15f2c247a86e240d4 (diff)
[POWERPC] Add spu disassembly to xmon
This patch adds a "sdi" command to xmon, to disassemble the contents of an spu's local store. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Diffstat (limited to 'arch/powerpc/xmon/xmon.c')
-rw-r--r--arch/powerpc/xmon/xmon.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index a39b17638b7b..7a0eec23cb9c 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -155,6 +155,7 @@ static int do_spu_cmd(void);
155int xmon_no_auto_backtrace; 155int xmon_no_auto_backtrace;
156 156
157extern int print_insn_powerpc(unsigned long insn, unsigned long memaddr); 157extern int print_insn_powerpc(unsigned long insn, unsigned long memaddr);
158extern int print_insn_spu(unsigned long insn, unsigned long memaddr);
158 159
159extern void xmon_enter(void); 160extern void xmon_enter(void);
160extern void xmon_leave(void); 161extern void xmon_leave(void);
@@ -219,7 +220,8 @@ Commands:\n\
219" ss stop execution on all spus\n\ 220" ss stop execution on all spus\n\
220 sr restore execution on stopped spus\n\ 221 sr restore execution on stopped spus\n\
221 sf # dump spu fields for spu # (in hex)\n\ 222 sf # dump spu fields for spu # (in hex)\n\
222 sd # dump spu local store for spu # (in hex)\n" 223 sd # dump spu local store for spu # (in hex)\
224 sdi # disassemble spu local store for spu # (in hex)\n"
223#endif 225#endif
224" S print special registers\n\ 226" S print special registers\n\
225 t print backtrace\n\ 227 t print backtrace\n\
@@ -2828,7 +2830,13 @@ static void dump_spu_fields(struct spu *spu)
2828 DUMP_FIELD(spu, "0x%p", priv2); 2830 DUMP_FIELD(spu, "0x%p", priv2);
2829} 2831}
2830 2832
2831static void dump_spu_ls(unsigned long num) 2833int
2834spu_inst_dump(unsigned long adr, long count, int praddr)
2835{
2836 return generic_inst_dump(adr, count, praddr, print_insn_spu);
2837}
2838
2839static void dump_spu_ls(unsigned long num, int subcmd)
2832{ 2840{
2833 unsigned long offset, addr, ls_addr; 2841 unsigned long offset, addr, ls_addr;
2834 2842
@@ -2855,9 +2863,17 @@ static void dump_spu_ls(unsigned long num)
2855 return; 2863 return;
2856 } 2864 }
2857 2865
2858 prdump(addr, 64); 2866 switch (subcmd) {
2859 addr += 64; 2867 case 'i':
2860 last_cmd = "sd\n"; 2868 addr += spu_inst_dump(addr, 16, 1);
2869 last_cmd = "sdi\n";
2870 break;
2871 default:
2872 prdump(addr, 64);
2873 addr += 64;
2874 last_cmd = "sd\n";
2875 break;
2876 }
2861 2877
2862 spu_info[num].dump_addr = addr; 2878 spu_info[num].dump_addr = addr;
2863} 2879}
@@ -2865,7 +2881,7 @@ static void dump_spu_ls(unsigned long num)
2865static int do_spu_cmd(void) 2881static int do_spu_cmd(void)
2866{ 2882{
2867 static unsigned long num = 0; 2883 static unsigned long num = 0;
2868 int cmd; 2884 int cmd, subcmd = 0;
2869 2885
2870 cmd = inchar(); 2886 cmd = inchar();
2871 switch (cmd) { 2887 switch (cmd) {
@@ -2875,8 +2891,11 @@ static int do_spu_cmd(void)
2875 case 'r': 2891 case 'r':
2876 restart_spus(); 2892 restart_spus();
2877 break; 2893 break;
2878 case 'f':
2879 case 'd': 2894 case 'd':
2895 subcmd = inchar();
2896 if (isxdigit(subcmd) || subcmd == '\n')
2897 termch = subcmd;
2898 case 'f':
2880 scanhex(&num); 2899 scanhex(&num);
2881 if (num >= XMON_NUM_SPUS || !spu_info[num].spu) { 2900 if (num >= XMON_NUM_SPUS || !spu_info[num].spu) {
2882 printf("*** Error: invalid spu number\n"); 2901 printf("*** Error: invalid spu number\n");
@@ -2888,7 +2907,7 @@ static int do_spu_cmd(void)
2888 dump_spu_fields(spu_info[num].spu); 2907 dump_spu_fields(spu_info[num].spu);
2889 break; 2908 break;
2890 default: 2909 default:
2891 dump_spu_ls(num); 2910 dump_spu_ls(num, subcmd);
2892 break; 2911 break;
2893 } 2912 }
2894 2913