+2076-02-05 H.J. Lu <hongjiu.lu@intel.com>
+
+ * ld-i386/pcrel16.d: Undo the last change.
+ * ld-x86-64/pcrel16.d: Likewise.
+
2076-02-02 H.J. Lu <hongjiu.lu@intel.com>
* ld-i386/pcrel16.d: Updated.
+2076-02-05 H.J. Lu <hongjiu.lu@intel.com>
+
+ * i386-dis.c (OP_J): Undo the last change. Properly handle 64K
+ wrap around within the same segment in 16bit mode.
+
2076-02-02 H.J. Lu <hongjiu.lu@intel.com>
* i386-dis.c (OP_J): Mask to 16bit only if there is a data16
{
bfd_vma disp;
bfd_vma mask = -1;
+ bfd_vma segment = 0;
switch (bytemode)
{
disp = get16 ();
if ((disp & 0x8000) != 0)
disp -= 0x10000;
- /* 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 ((prefixes & PREFIX_DATA) != 0)
- mask = 0xffff;
+ /* 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;
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);