This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Fix disassemble of 64 bit jumps on x86-64
- To: binutils at sources dot redhat dot com
- Subject: Fix disassemble of 64 bit jumps on x86-64
- From: Andreas Jaeger <aj at suse dot de>
- Date: Mon, 09 Jul 2001 11:09:37 +0200
- Cc: Karsten Keil <kkeil at suse dot de>, patches at x86-64 dot org
The i386 disassembler prints out a number of addresses in 32 bit -
even in 64-bit mode for x86-64, for example:
ffffffff8010b987: e8 c0 5b 00 00 callq 8011154c <SS+0x801114ac>
The 8011154c should be ffffffff8011154c.
I'm appending a patch that fixes those problems. It passes the
testsuite for i386 (with and without --enable-64-bit-bfd) and x86-64.
Ok to commit?
Andreas
2001-07-09 Andreas Jaeger <aj@suse.de>, Karsten Keil <kkeil@suse.de>
* i386-dis.c (set_op): Handle 64 bit and 32 bit mode.
(OP_J): Use bfd_vma for mask to work properly with 64 bits.
(op_address,op_riprel): Use bfd_vma to handle 64 bits.
============================================================
Index: opcodes/i386-dis.c
--- opcodes/i386-dis.c 2001/06/11 13:25:07 1.26
+++ opcodes/i386-dis.c 2001/07/09 08:37:47
@@ -67,7 +67,7 @@
static bfd_signed_vma get32 PARAMS ((void));
static bfd_signed_vma get32s PARAMS ((void));
static int get16 PARAMS ((void));
-static void set_op PARAMS ((unsigned int, int));
+static void set_op PARAMS ((bfd_vma, int));
static void OP_REG PARAMS ((int, int));
static void OP_IMREG PARAMS ((int, int));
static void OP_I PARAMS ((int, int));
@@ -1786,8 +1786,8 @@
static char op1out[100], op2out[100], op3out[100];
static int op_ad, op_index[3];
-static unsigned int op_address[3];
-static unsigned int op_riprel[3];
+static bfd_vma op_address[3];
+static bfd_vma op_riprel[3];
static bfd_vma start_pc;
@@ -3238,12 +3238,20 @@
static void
set_op (op, riprel)
- unsigned int op;
+ bfd_vma op;
int riprel;
{
op_index[op_ad] = op_ad;
- op_address[op_ad] = op;
- op_riprel[op_ad] = riprel;
+ if (mode_64bit)
+ {
+ op_address[op_ad] = op;
+ op_riprel[op_ad] = riprel;
+ }
+ else
+ {
+ op_address[op_ad] = (unsigned int) op;
+ op_riprel[op_ad] = (unsigned int) riprel;
+ }
}
static void
@@ -3515,7 +3523,7 @@
int sizeflag;
{
bfd_vma disp;
- int mask = -1;
+ bfd_vma mask = -1;
switch (bytemode)
{
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj