* configure.ac: Add mips*-sde-elf* target.
[deliverable/binutils-gdb.git] / opcodes / i386-dis.c
index 58f630eac0de122479bd81c1e23a92e2c51a35b0..509cc5d38a3b92f2e6af9e4a10f7868b90099ef6 100644 (file)
@@ -4901,6 +4901,7 @@ OP_J (int bytemode, int sizeflag)
 {
   bfd_vma disp;
   bfd_vma mask = -1;
+  bfd_vma segment = 0;
 
   switch (bytemode)
     {
@@ -4916,10 +4917,16 @@ OP_J (int bytemode, int sizeflag)
       else
        {
          disp = get16 ();
-         /* For some reason, a data16 prefix on a jump instruction
-            means that the pc is masked to 16 bits after the
-            displacement is added!  */
+         if ((disp & 0x8000) != 0)
+           disp -= 0x10000;
+         /* In 16bit mode, address is wrapped around at 64k within
+            the same segment.  Otherwise, a data16 prefix on a jump
+            instruction means that the pc is masked to 16 bits after
+            the displacement is added!  */
          mask = 0xffff;
+         if ((prefixes & PREFIX_DATA) == 0)
+           segment = ((start_pc + codep - start_codep)
+                      & ~((bfd_vma) 0xffff));
        }
       used_prefixes |= (prefixes & PREFIX_DATA);
       break;
@@ -4927,7 +4934,7 @@ OP_J (int bytemode, int sizeflag)
       oappend (INTERNAL_DISASSEMBLER_ERROR);
       return;
     }
-  disp = (start_pc + codep - start_codep + disp) & mask;
+  disp = ((start_pc + codep - start_codep + disp) & mask) | segment;
   set_op (disp, 0);
   print_operand_value (scratchbuf, 1, disp);
   oappend (scratchbuf);
This page took 0.023406 seconds and 4 git commands to generate.