PATCH: use symbolic names when disassembling spu channel insns

luke hutchinson hutcho.luke@gmail.com
Sun Dec 5 02:07:00 GMT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

This patch uses the symbolic channel names from the CBEA (version 1.02)
when disassembling instructions.  Unknown channels are still displayed
as $ch%u format.

- - Luke

ps. first time looked at binutils source, let me know if i haven't
followed coding standards correctly, etc

pps. other patches posted to this mailing list use diff --git.  latest
diff for Ubuntu 10,10 doesn't support this argument, is -au ok ?






LC_ALL=C TZ=UTC0 diff -au
binutils-2.20.51.20100908-orig/opcodes/spu-dis.c
binutils-2.20.51.20100908/opcodes/spu-dis.c
- --- binutils-2.20.51.20100908-orig/opcodes/spu-dis.c	2010-12-05
00:02:14.486600861 +0000
+++ binutils-2.20.51.20100908/opcodes/spu-dis.c	2010-12-05
01:03:20.000000000 +0000
@@ -87,6 +87,49 @@
   return 0;
 }

+/* Select format string for printing channel name. */
+static const char *
+get_channel_format_string (unsigned int channel_num)
+{
+  static const char * const strings[] =
+  {
+    "$SPU_RdEventStat",
+    "$SPU_WrEventMask",
+    "$SPU_WrEventAck",
+    "$SPU_RdSigNotify1",
+    "$SPU_RdSigNotify2",
+    "$ch%u",
+    "$ch%u",
+    "$SPU_WrDec",
+    "$SPU_RdDec",
+    "$MFC_WrMSSyncReq",
+    "$ch%u",
+    "$SPU_RdEventMask",
+    "$MFC_RdTagMask",
+    "$SPU_RdMachStat",
+    "$SPU_WrSRR0",
+    "$SPU_RdSRR0",
+    "$MFC_LSA",
+    "$MFC_EAH",
+    "$MFC_EAL",
+    "$MFC_Size",
+    "$MFC_TagID",
+    "$MFC_Cmd",
+    "$MFC_WrTagMask",
+    "$MFC_WrTagUpdate",
+    "$MFC_RdTagStat",
+    "$MFC_RdListStallStat",
+    "$MFC_WrListStallAck",
+    "$MFC_RdAtomicStat",
+    "$SPU_WrOutMbox",
+    "$SPU_RdInMbox",
+    "$SPU_WrOutIntrMbox"
+  };
+  if (channel_num < sizeof(strings)/sizeof(*strings))
+    return strings[channel_num];
+  return "$ch%u";
+}
+
 /* Print a Spu instruction.  */

 int
@@ -165,8 +208,9 @@
 				     DECODE_INSN_RA (insn));
 	      break;
 	    case A_H:
- -	      (*info->fprintf_func) (info->stream, "$ch%d",
- -				     DECODE_INSN_RA (insn));
+          value = DECODE_INSN_RA (insn);
+	      (*info->fprintf_func) (info->stream,
+                     get_channel_format_string(value), value);
 	      break;
 	    case A_P:
 	      paren++;
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJM+vPvAAoJEPycJhJ2o4QYlrsP/R+pMTBP/U9fiQYksV+H+ke7
RFp1rjQVYvSceYasQSygEREGH7Wc6S6+2soUJZ9p7a0Sb7opS63M33Lrwvqi7T9M
r9t+WXWSpvjQfSKHfr3wsO3hSry2zKaURTJw14R963ZtVx8fIyJ+fbOiuHu1Qofs
uNoyo7tYzw48P0s15vd5F5YywVHeUZMCbz7p8klsnDyOi1kcG0q4gmIvLorWultx
VvDfwxLiyWRb3O18hbvVS6mxHK5GJs3kttfS09nyPDoEQjCTy9PMTfRGLH6ciSv3
LOO8Wetp8ISktjoAkhNEhI4cnJQXXl8Gc4kzbVkP6keN9lLfM8mn3O9N6QnagfS8
DuOuLJQGJp+airQsp9CRb8EJIia/aQjbthr5D13dZpmL58FrSGCWnX/X3+2P1Zic
FnC+Wb6j8wRZaB5okGS3I0bV+dQy5Lwo7M7bM05a3nVndQoKYYzJfsiCx39HqUIa
XaAXs2LZ2FmecuA7mJtC2Yra0R1CiWDKiykHY4Lv6EWCD64NdJ+k04z1RnirXBMX
0v4iEO1jbo/I3cy+zIMKqr+LW1bIqidogQ7t2SPnWuNdupkjf764Z4KgSG5sSJPt
9am6gTMfRnScC0LPkWyBEQzLzRA+/h5t2g1oniU3hWRGpGUpynSYw5iOJXpzAFrC
IuZfzo5OucYN6HEeRSKh
=Vn3z
-----END PGP SIGNATURE-----



More information about the Binutils mailing list