This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB 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]

Fix for Thumb BLX instruction - addendum


Hi Guys,

  I forgot to include the patch for the disassembler.  Sorry!

Cheers
        Nick

2002-05-23  Nick Clifton  <nickc@cambridge.redhat.com>

	* arm-dis.c (print_insn_thumb): Fix handling of BLX instruction to
	conform to Operations definition in the ARM ARM.

Index: opcodes/arm-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/arm-dis.c,v
retrieving revision 1.27
diff -c -3 -p -w -r1.27 arm-dis.c
*** opcodes/arm-dis.c	19 Jan 2002 12:27:24 -0000	1.27
--- opcodes/arm-dis.c	23 May 2002 12:45:36 -0000
*************** print_insn_thumb (pc, info, given)
*** 765,790 ****
  	      info->bytes_per_line  = 4;
  
  	      offset = BDISP23 (given);
  	      
  	      if ((given & 0x10000000) == 0)
  		{
  		  func (stream, "blx\t");
! 
! 		  /* The spec says that bit 1 of the branch's destination
! 		     address comes from bit 1 of the instruction's
! 		     address and not from the offset in the instruction.  */
! 		  if (offset & 0x1)
! 		    {
! 		      /* func (stream, "*malformed!* "); */
! 		      offset &= ~ 0x1;
! 		    }
! 
! 		  offset |= ((pc & 0x2) >> 1);
  		}
  	      else
  		func (stream, "bl\t");
  
! 	      info->print_address_func (offset * 2 + pc + 4, info);
                return 4;
              }
            else
--- 765,781 ----
  	      info->bytes_per_line  = 4;
  
  	      offset = BDISP23 (given);
+ 	      offset = offset * 2 + pc + 4;
  
  	      if ((given & 0x10000000) == 0)
  		{
  		  func (stream, "blx\t");
! 		  offset &= 0xfffffffc;
  		}
  	      else
  		func (stream, "bl\t");
  
! 	      info->print_address_func (offset, info);
                return 4;
              }
            else


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