diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2006-11-22 18:46:44 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-12-04 04:40:31 -0500 |
commit | af89fb8041562508895c8f3ba04790d7c2f4338c (patch) | |
tree | 5b1bdbd2769400b0506a8fa4be64e3fd1d7fed9b /arch | |
parent | ae06e374c15c5d62e08c19c15f2c247a86e240d4 (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')
-rw-r--r-- | arch/powerpc/xmon/Makefile | 1 | ||||
-rw-r--r-- | arch/powerpc/xmon/xmon.c | 35 |
2 files changed, 28 insertions, 8 deletions
diff --git a/arch/powerpc/xmon/Makefile b/arch/powerpc/xmon/Makefile index 109d874ecfbe..4f274056e770 100644 --- a/arch/powerpc/xmon/Makefile +++ b/arch/powerpc/xmon/Makefile | |||
@@ -5,3 +5,4 @@ EXTRA_CFLAGS += -mno-minimal-toc | |||
5 | endif | 5 | endif |
6 | obj-y += xmon.o ppc-dis.o ppc-opc.o setjmp.o start.o \ | 6 | obj-y += xmon.o ppc-dis.o ppc-opc.o setjmp.o start.o \ |
7 | nonstdio.o | 7 | nonstdio.o |
8 | obj-$(CONFIG_PPC_CELL) += spu-dis.o spu-opc.o | ||
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); | |||
155 | int xmon_no_auto_backtrace; | 155 | int xmon_no_auto_backtrace; |
156 | 156 | ||
157 | extern int print_insn_powerpc(unsigned long insn, unsigned long memaddr); | 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 | extern void xmon_enter(void); | 160 | extern void xmon_enter(void); |
160 | extern void xmon_leave(void); | 161 | extern 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 | ||
2831 | static void dump_spu_ls(unsigned long num) | 2833 | int |
2834 | spu_inst_dump(unsigned long adr, long count, int praddr) | ||
2835 | { | ||
2836 | return generic_inst_dump(adr, count, praddr, print_insn_spu); | ||
2837 | } | ||
2838 | |||
2839 | static 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) | |||
2865 | static int do_spu_cmd(void) | 2881 | static 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 | ||