linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <michael@ellerman.id.au>
To: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@ozlabs.org, Arnd Bergmann <arnd.bergmann@de.ibm.com>
Subject: [RFC/PATCH 6/9] Add spu disassembly to xmon
Date: Thu, 16 Nov 2006 18:23:26 +1100	[thread overview]
Message-ID: <20061116072327.C55EA67C83@ozlabs.org> (raw)
In-Reply-To: <1163661800.406227.631357998554.qpush@cradle>

This patch adds a "sdi" command to xmon, to disassemble the contents
of an spu's local store.

---

 arch/powerpc/xmon/Makefile |    1 +
 arch/powerpc/xmon/xmon.c   |   35 +++++++++++++++++++++++++++--------
 2 files changed, 28 insertions(+), 8 deletions(-)

Index: cell/arch/powerpc/xmon/Makefile
===================================================================
--- cell.orig/arch/powerpc/xmon/Makefile
+++ cell/arch/powerpc/xmon/Makefile
@@ -5,3 +5,4 @@ EXTRA_CFLAGS += -mno-minimal-toc
 endif
 obj-y			+= xmon.o ppc-dis.o ppc-opc.o setjmp.o start.o \
 			   nonstdio.o
+obj-$(CONFIG_PPC_CELL)	+= spu-dis.o spu-opc.o
Index: cell/arch/powerpc/xmon/xmon.c
===================================================================
--- cell.orig/arch/powerpc/xmon/xmon.c
+++ cell/arch/powerpc/xmon/xmon.c
@@ -154,6 +154,7 @@ static int do_spu_cmd(void);
 int xmon_no_auto_backtrace;
 
 extern int print_insn_powerpc(unsigned long insn, unsigned long memaddr);
+extern int print_insn_spu(unsigned long insn, unsigned long memaddr);
 
 extern void xmon_enter(void);
 extern void xmon_leave(void);
@@ -218,7 +219,8 @@ Commands:\n\
 "  ss	stop execution on all spus\n\
   sr	restore execution on stopped spus\n\
   sf  #	dump spu fields for spu # (in hex)\n\
-  sd  #	dump spu local store for spu # (in hex)\n"
+  sd  #	dump spu local store for spu # (in hex)\
+  sdi #	disassemble spu local store for spu # (in hex)\n"
 #endif
 "  S	print special registers\n\
   t	print backtrace\n\
@@ -2826,7 +2828,13 @@ static void dump_spu_fields(struct spu *
 	DUMP_FIELD(spu, "0x%p", priv2);
 }
 
-static void dump_spu_ls(unsigned long num)
+int
+spu_inst_dump(unsigned long adr, long count, int praddr)
+{
+	return generic_inst_dump(adr, count, praddr, print_insn_spu);
+}
+
+static void dump_spu_ls(unsigned long num, int subcmd)
 {
 	unsigned long offset, addr, ls_addr;
 
@@ -2853,9 +2861,17 @@ static void dump_spu_ls(unsigned long nu
 		return;
 	}
 
-	prdump(addr, 64);
-	addr += 64;
-	last_cmd = "sd\n";
+	switch (subcmd) {
+	case 'i':
+		addr += spu_inst_dump(addr, 16, 1);
+		last_cmd = "sdi\n";
+		break;
+	default:
+		prdump(addr, 64);
+		addr += 64;
+		last_cmd = "sd\n";
+		break;
+	}
 
 	spu_info[num].dump_addr = addr;
 }
@@ -2863,7 +2879,7 @@ static void dump_spu_ls(unsigned long nu
 static int do_spu_cmd(void)
 {
 	static unsigned long num = 0;
-	int cmd;
+	int cmd, subcmd = 0;
 
 	cmd = inchar();
 	switch (cmd) {
@@ -2873,8 +2889,11 @@ static int do_spu_cmd(void)
 	case 'r':
 		restart_spus();
 		break;
-	case 'f':
 	case 'd':
+		subcmd = inchar();
+		if (isxdigit(subcmd) || subcmd == '\n')
+			termch = subcmd;
+	case 'f':
 		scanhex(&num);
 		if (num >= XMON_NUM_SPUS || !spu_info[num].spu) {
 			printf("*** Error: invalid spu number\n");
@@ -2886,7 +2905,7 @@ static int do_spu_cmd(void)
 			dump_spu_fields(spu_info[num].spu);
 			break;
 		default:
-			dump_spu_ls(num);
+			dump_spu_ls(num, subcmd);
 			break;
 		}
 

  parent reply	other threads:[~2006-11-16  7:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-16  7:23 [RFC/PATCH 0/9] More xmon cell patches Michael Ellerman
2006-11-16  7:23 ` [RFC/PATCH 1/9] Fix sparse warning in xmon Cell code Michael Ellerman
2006-11-16  7:23 ` [RFC/PATCH 3/9] Add a 'sd' command (spu dump) to xmon to dump spu local store Michael Ellerman
2006-11-16  7:23 ` [RFC/PATCH 2/9] Show state of spus as they're stopped in Cell xmon helper Michael Ellerman
2006-11-16  7:23 ` [RFC/PATCH 4/9] Prepare for spu disassembly in xmon Michael Ellerman
2006-11-16  7:23 ` [RFC/PATCH 5/9] Import spu disassembly code into xmon Michael Ellerman
2006-11-16  7:23 ` Michael Ellerman [this message]
2006-11-16  7:23 ` [RFC/PATCH 7/9] Make xmon disassembly optional Michael Ellerman
2006-11-16  7:23 ` [RFC/PATCH 8/9] Make 64-bit cpu features defined on 32-bit Michael Ellerman
2006-11-16 10:17   ` Stephen Rothwell
2006-11-16 23:03     ` Michael Ellerman
2006-11-16  7:23 ` [RFC/PATCH 9/9] Import updated version of ppc disassembly code for xmon Michael Ellerman
2006-11-16 21:20 ` [RFC/PATCH 0/9] More xmon cell patches Arnd Bergmann
2006-11-20 22:06   ` Paul Mackerras
2006-11-21 10:24 ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061116072327.C55EA67C83@ozlabs.org \
    --to=michael@ellerman.id.au \
    --cc=arnd.bergmann@de.ibm.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).