This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, Comitted] Do proper endian transform when reading instructionfrom memory for bfin


This patch makes bfin port objdump disassemble instructions correctly on PPC host.

Jie
2005-10-18  Jie Zhang  <jie.zhang@analog.com>

	* bfin-dis.c (print_insn_bfin): Do proper endian transform when
	reading instruction from memory.

Index: bfin-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/bfin-dis.c,v
retrieving revision 1.1
diff -u -r1.1 bfin-dis.c
--- bfin-dis.c	30 Sep 2005 15:28:50 -0000	1.1
+++ bfin-dis.c	18 Oct 2005 16:34:02 -0000
@@ -5765,13 +5765,18 @@
 int
 print_insn_bfin (bfd_vma pc, disassemble_info *outf)
 {
-  short iw0 = 0;
-  int status = 0;
+  bfd_byte buf[2];
+  unsigned short iw0;
+  int status;
   int count = 0;
-  status = (*outf->read_memory_func) (pc & ~0x01, (bfd_byte *) & iw0, 2, outf);
+
+  status = (*outf->read_memory_func) (pc & ~0x01, buf, 2, outf);
+  iw0 = bfd_getl16 (buf);
 
   count += _print_insn_bfin (pc, outf);
+
   /* Proper display of multiple issue instructions.  */
+
   if ((iw0 & 0xc000) == 0xc000 && (iw0 & BIT_MULTI_INS)
       && ((iw0 & 0xe800) != 0xe800 /* not Linkage */ ))
     {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]