Fri Jun 12 11:04:06 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>

Fix problems when bfd_vma is wider than long.
	* i386-dis.c: Make op_address and start_pc unsigned.
	(set_op): Make parameter unsigned.
	(print_insn_x86): Cast to bfd_vma when passing a value to
	print_address_func.
	* ns32k-dis.c (CORE_ADDR): Don't define.
 	(print_insn_ns32k): Change type of addr to bfd_vma.  Use
	bfd_scan_vma to read back address.
	(print_insn_arg): Change type of addr to bfd_vma.  Use sprintf_vma
	to format it.
	* m68k-dis.c (COERCE32): Cast to bfd_signed_vma to avoid overflow.
	(NEXTULONG): New definition.
	(print_insn_m68k): Avoid overflow when computing third argument of
	print_insn_arg.
	(print_insn_arg): Use NEXTULONG to fetch 32 bit address values.
	Use disp instead of val to store offset values.
	(print_indexed): Use base_disp instead of word to store base
	displacement, to avoid overflow.
	* m10300-dis.c (disassemble): Cast value to long when computing
	pc-relative address, to get correct sign extension.
This commit is contained in:
Ian Lance Taylor 1998-06-12 15:13:28 +00:00
parent 1be932424c
commit 80ade9931a
2 changed files with 31 additions and 7 deletions

View File

@ -1,3 +1,26 @@
Fri Jun 12 11:04:06 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
Fix problems when bfd_vma is wider than long.
* i386-dis.c: Make op_address and start_pc unsigned.
(set_op): Make parameter unsigned.
(print_insn_x86): Cast to bfd_vma when passing a value to
print_address_func.
* ns32k-dis.c (CORE_ADDR): Don't define.
(print_insn_ns32k): Change type of addr to bfd_vma. Use
bfd_scan_vma to read back address.
(print_insn_arg): Change type of addr to bfd_vma. Use sprintf_vma
to format it.
* m68k-dis.c (COERCE32): Cast to bfd_signed_vma to avoid overflow.
(NEXTULONG): New definition.
(print_insn_m68k): Avoid overflow when computing third argument of
print_insn_arg.
(print_insn_arg): Use NEXTULONG to fetch 32 bit address values.
Use disp instead of val to store offset values.
(print_indexed): Use base_disp instead of word to store base
displacement, to avoid overflow.
* m10300-dis.c (disassemble): Cast value to long when computing
pc-relative address, to get correct sign extension.
Wed Jun 10 15:58:37 1998 Doug Evans <devans@canuck.cygnus.com>
* m32r-opc.c: Regenerate.

View File

@ -189,7 +189,7 @@ static void OP_EM PARAMS ((int, int));
static void OP_MS PARAMS ((int, int));
static void append_seg PARAMS ((void));
static void set_op PARAMS ((int op));
static void set_op PARAMS ((unsigned int op));
static void putop PARAMS ((char *template, int sizeflag));
static void dofloat PARAMS ((int sizeflag));
static int get16 PARAMS ((void));
@ -1146,8 +1146,9 @@ ckprefix ()
}
static char op1out[100], op2out[100], op3out[100];
static int op_address[3], op_ad, op_index[3];
static int start_pc;
static int op_ad, op_index[3];
static unsigned int op_address[3];
static unsigned int start_pc;
/*
@ -1326,7 +1327,7 @@ print_insn_x86 (pc, info, sizeflag)
if (*first)
{
if (op_index[0] != -1)
(*info->print_address_func) (op_address[op_index[0]], info);
(*info->print_address_func) ((bfd_vma) op_address[op_index[0]], info);
else
(*info->fprintf_func) (info->stream, "%s", first);
needcomma = 1;
@ -1336,7 +1337,7 @@ print_insn_x86 (pc, info, sizeflag)
if (needcomma)
(*info->fprintf_func) (info->stream, ",");
if (op_index[1] != -1)
(*info->print_address_func) (op_address[op_index[1]], info);
(*info->print_address_func) ((bfd_vma) op_address[op_index[1]], info);
else
(*info->fprintf_func) (info->stream, "%s", second);
needcomma = 1;
@ -1346,7 +1347,7 @@ print_insn_x86 (pc, info, sizeflag)
if (needcomma)
(*info->fprintf_func) (info->stream, ",");
if (op_index[2] != -1)
(*info->print_address_func) (op_address[op_index[2]], info);
(*info->print_address_func) ((bfd_vma) op_address[op_index[2]], info);
else
(*info->fprintf_func) (info->stream, "%s", third);
}
@ -1929,7 +1930,7 @@ get16 ()
static void
set_op (op)
int op;
unsigned int op;
{
op_index[op_ad] = op_ad;
op_address[op_ad] = op;