summaryrefslogtreecommitdiff
path: root/opcodes/m68k-dis.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2008-11-26 10:43:18 +0000
committerAndreas Schwab <schwab@linux-m68k.org>2008-11-26 10:43:18 +0000
commitc07c62529f6fcf4ff6b849a5e0391d7c43d9bc50 (patch)
treef954f34211646387fb03ecf74efd523534c627c5 /opcodes/m68k-dis.c
parent5be5130f63e952c20b7bfd8d8992a1f7ef03df01 (diff)
downloadbinutils-redhat-c07c62529f6fcf4ff6b849a5e0391d7c43d9bc50.tar.gz
(NEXTBYTE, NEXTWORD, NEXTLONG, NEXTULONG, NEXTSINGLE)
(NEXTDOUBLE, NEXTEXTEND, NEXTPACKED): Fix error handling. (save_printer, save_print_address): Remove. (fetch_data): Don't use them. (match_insn_m68k): Always restore printing functions. (print_insn_m68k): Don't save/restore printing functions.
Diffstat (limited to 'opcodes/m68k-dis.c')
-rw-r--r--opcodes/m68k-dis.c36
1 files changed, 9 insertions, 27 deletions
diff --git a/opcodes/m68k-dis.c b/opcodes/m68k-dis.c
index 88365706bd..076e646407 100644
--- a/opcodes/m68k-dis.c
+++ b/opcodes/m68k-dis.c
@@ -64,7 +64,7 @@ static char *const reg_half_names[] =
do \
{ \
p += 2; \
- if (FETCH_DATA (info, p) < 0) \
+ if (!FETCH_DATA (info, p)) \
return -3; \
val = COERCE_SIGNED_CHAR (p[-1]); \
} \
@@ -77,7 +77,7 @@ static char *const reg_half_names[] =
do \
{ \
p += 2; \
- if (FETCH_DATA (info, p) < 0) \
+ if (!FETCH_DATA (info, p)) \
return ret_val; \
val = COERCE16 ((p[-2] << 8) + p[-1]); \
} \
@@ -90,7 +90,7 @@ static char *const reg_half_names[] =
do \
{ \
p += 4; \
- if (FETCH_DATA (info, p) < 0) \
+ if (!FETCH_DATA (info, p)) \
return ret_val; \
val = COERCE32 ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1]); \
} \
@@ -101,7 +101,7 @@ static char *const reg_half_names[] =
do \
{ \
p += 4; \
- if (FETCH_DATA (info, p) < 0) \
+ if (!FETCH_DATA (info, p)) \
return -3; \
val = (unsigned int) ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1]); \
} \
@@ -112,7 +112,7 @@ static char *const reg_half_names[] =
do \
{ \
p += 4; \
- if (FETCH_DATA (info, p) < 0) \
+ if (!FETCH_DATA (info, p)) \
return -3; \
floatformat_to_double (& floatformat_ieee_single_big, \
(char *) p - 4, & val); \
@@ -124,7 +124,7 @@ static char *const reg_half_names[] =
do \
{ \
p += 8; \
- if (FETCH_DATA (info, p) , 0) \
+ if (!FETCH_DATA (info, p)) \
return -3; \
floatformat_to_double (& floatformat_ieee_double_big, \
(char *) p - 8, & val); \
@@ -136,7 +136,7 @@ static char *const reg_half_names[] =
do \
{ \
p += 12; \
- if (FETCH_DATA (info, p) < 0) \
+ if (!FETCH_DATA (info, p)) \
return -3; \
floatformat_to_double (& floatformat_m68881_ext, \
(char *) p - 12, & val); \
@@ -151,7 +151,7 @@ static char *const reg_half_names[] =
do \
{ \
p += 12; \
- if (FETCH_DATA (info, p) < 0) \
+ if (!FETCH_DATA (info, p)) \
return -3; \
val = 0.0; \
} \
@@ -171,9 +171,6 @@ struct private
bfd_vma insn_start;
};
-static fprintf_ftype save_printer;
-static void (* save_print_address) (bfd_vma, struct disassemble_info *);
-
/* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive)
to ADDR (exclusive) are valid. Returns 1 for success, 0 on error. */
#define FETCH_DATA(info, addr) \
@@ -194,8 +191,6 @@ fetch_data (struct disassemble_info *info, bfd_byte *addr)
if (status != 0)
{
(*info->memory_error_func) (status, start, info);
- info->fprintf_func = save_printer;
- info->print_address_func = save_print_address;
return 0;
}
else
@@ -1400,14 +1395,12 @@ match_insn_m68k (bfd_vma memaddr,
if (eaten >= 0)
p += eaten;
- else if (eaten == -1)
+ else if (eaten == -1 || eaten == -3)
{
info->fprintf_func = save_printer;
info->print_address_func = save_print_address;
return 0;
}
- else if (eaten == -3)
- return 0;
else
{
/* We must restore the print functions before trying to print the
@@ -1574,19 +1567,12 @@ m68k_scan_mask (bfd_vma memaddr, disassemble_info *info,
int
print_insn_m68k (bfd_vma memaddr, disassemble_info *info)
{
- fprintf_ftype save_printer;
- void (* save_print_address) (bfd_vma, struct disassemble_info *);
unsigned int arch_mask;
struct private priv;
int val;
bfd_byte *buffer = priv.the_buffer;
- /* Save these printing functions in case we need to restore them
- later. */
- save_printer = info->fprintf_func;
- save_print_address = info->print_address_func;
-
info->private_data = & priv;
/* Tell objdump to use two bytes per chunk
and six bytes per line for displaying raw data. */
@@ -1614,9 +1600,5 @@ print_insn_m68k (bfd_vma memaddr, disassemble_info *info)
/* Handle undefined instructions. */
info->fprintf_func (info->stream, "0%o", (buffer[0] << 8) + buffer[1]);
- /* Restore print functions. */
- info->fprintf_func = save_printer;
- info->print_address_func = save_print_address;
-
return val ? val : 2;
}