Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Michael Ellerman and committed by
Paul Mackerras
af89fb80 ae06e374

+28 -8
+1
arch/powerpc/xmon/Makefile
··· 5 5 endif 6 6 obj-y += xmon.o ppc-dis.o ppc-opc.o setjmp.o start.o \ 7 7 nonstdio.o 8 + obj-$(CONFIG_PPC_CELL) += spu-dis.o spu-opc.o
+27 -8
arch/powerpc/xmon/xmon.c
··· 155 155 int xmon_no_auto_backtrace; 156 156 157 157 extern int print_insn_powerpc(unsigned long insn, unsigned long memaddr); 158 + extern int print_insn_spu(unsigned long insn, unsigned long memaddr); 158 159 159 160 extern void xmon_enter(void); 160 161 extern void xmon_leave(void); ··· 220 219 " ss stop execution on all spus\n\ 221 220 sr restore execution on stopped spus\n\ 222 221 sf # dump spu fields for spu # (in hex)\n\ 223 - sd # dump spu local store for spu # (in hex)\n" 222 + sd # dump spu local store for spu # (in hex)\ 223 + sdi # disassemble spu local store for spu # (in hex)\n" 224 224 #endif 225 225 " S print special registers\n\ 226 226 t print backtrace\n\ ··· 2830 2828 DUMP_FIELD(spu, "0x%p", priv2); 2831 2829 } 2832 2830 2833 - static void dump_spu_ls(unsigned long num) 2831 + int 2832 + spu_inst_dump(unsigned long adr, long count, int praddr) 2833 + { 2834 + return generic_inst_dump(adr, count, praddr, print_insn_spu); 2835 + } 2836 + 2837 + static void dump_spu_ls(unsigned long num, int subcmd) 2834 2838 { 2835 2839 unsigned long offset, addr, ls_addr; 2836 2840 ··· 2863 2855 return; 2864 2856 } 2865 2857 2866 - prdump(addr, 64); 2867 - addr += 64; 2868 - last_cmd = "sd\n"; 2858 + switch (subcmd) { 2859 + case 'i': 2860 + addr += spu_inst_dump(addr, 16, 1); 2861 + last_cmd = "sdi\n"; 2862 + break; 2863 + default: 2864 + prdump(addr, 64); 2865 + addr += 64; 2866 + last_cmd = "sd\n"; 2867 + break; 2868 + } 2869 2869 2870 2870 spu_info[num].dump_addr = addr; 2871 2871 } ··· 2881 2865 static int do_spu_cmd(void) 2882 2866 { 2883 2867 static unsigned long num = 0; 2884 - int cmd; 2868 + int cmd, subcmd = 0; 2885 2869 2886 2870 cmd = inchar(); 2887 2871 switch (cmd) { ··· 2891 2875 case 'r': 2892 2876 restart_spus(); 2893 2877 break; 2894 - case 'f': 2895 2878 case 'd': 2879 + subcmd = inchar(); 2880 + if (isxdigit(subcmd) || subcmd == '\n') 2881 + termch = subcmd; 2882 + case 'f': 2896 2883 scanhex(&num); 2897 2884 if (num >= XMON_NUM_SPUS || !spu_info[num].spu) { 2898 2885 printf("*** Error: invalid spu number\n"); ··· 2907 2888 dump_spu_fields(spu_info[num].spu); 2908 2889 break; 2909 2890 default: 2910 - dump_spu_ls(num); 2891 + dump_spu_ls(num, subcmd); 2911 2892 break; 2912 2893 } 2913 2894