#include <setjmp.h>
-static int fetch_data (struct disassemble_info *, bfd_byte *);
+static int fetch_data2(struct disassemble_info *, bfd_byte *);
+static int fetch_data(struct disassemble_info *, bfd_byte *);
static void ckprefix (void);
static const char *prefix_name (int, int);
static int print_insn (bfd_vma, disassemble_info *);
/* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive)
to ADDR (exclusive) are valid. Returns 1 for success, longjmps
on error. */
-#define FETCH_DATA(info, addr) \
- ((addr) <= ((struct dis_private *) (info->private_data))->max_fetched \
- ? 1 : fetch_data ((info), (addr)))
-
static int
-fetch_data (struct disassemble_info *info, bfd_byte *addr)
+fetch_data2(struct disassemble_info *info, bfd_byte *addr)
{
int status;
struct dis_private *priv = (struct dis_private *) info->private_data;
return 1;
}
+static int
+fetch_data(struct disassemble_info *info, bfd_byte *addr)
+{
+ if (addr <= ((struct dis_private *) (info->private_data))->max_fetched) {
+ return 1;
+ } else {
+ return fetch_data2(info, addr);
+ }
+}
+
+
#define XX { NULL, 0 }
#define Eb { OP_E, b_mode }
rex_used = 0;
while (1)
{
- FETCH_DATA (the_info, codep + 1);
+ fetch_data(the_info, codep + 1);
newrex = 0;
switch (*codep)
{
insn_codep = codep;
sizeflag = priv.orig_sizeflag;
- FETCH_DATA (info, codep + 1);
+ fetch_data(info, codep + 1);
two_source_ops = (*codep == 0x62) || (*codep == 0xc8);
if (((prefixes & PREFIX_FWAIT)
if (*codep == 0x0f)
{
unsigned char threebyte;
- FETCH_DATA (info, codep + 2);
+ fetch_data(info, codep + 2);
threebyte = *++codep;
dp = &dis386_twobyte[threebyte];
need_modrm = twobyte_has_modrm[*codep];
codep++;
if (dp->name == NULL && dp->op[0].bytemode == IS_3BYTE_OPCODE)
{
- FETCH_DATA (info, codep + 2);
+ fetch_data(info, codep + 2);
op = *codep++;
switch (threebyte)
{
}
else if (need_modrm)
{
- FETCH_DATA (info, codep + 1);
+ fetch_data(info, codep + 1);
modrm.mod = (*codep >> 6) & 3;
modrm.reg = (*codep >> 3) & 7;
modrm.rm = *codep & 7;
if (base == 4)
{
havesib = 1;
- FETCH_DATA (the_info, codep + 1);
+ fetch_data(the_info, codep + 1);
index = (*codep >> 3) & 7;
if (address_mode == mode_64bit || index != 0x4)
/* When INDEX == 0x4 in 32 bit mode, SCALE is ignored. */
}
break;
case 1:
- FETCH_DATA (the_info, codep + 1);
+ fetch_data (the_info, codep + 1);
disp = *codep++;
if ((disp & 0x80) != 0)
disp -= 0x100;
}
break;
case 1:
- FETCH_DATA (the_info, codep + 1);
+ fetch_data(the_info, codep + 1);
disp = *codep++;
if ((disp & 0x80) != 0)
disp -= 0x100;
unsigned int a;
unsigned int b;
- FETCH_DATA (the_info, codep + 8);
+ fetch_data(the_info, codep + 8);
a = *codep++ & 0xff;
a |= (*codep++ & 0xff) << 8;
a |= (*codep++ & 0xff) << 16;
{
bfd_signed_vma x = 0;
- FETCH_DATA (the_info, codep + 4);
+ fetch_data(the_info, codep + 4);
x = *codep++ & (bfd_signed_vma) 0xff;
x |= (*codep++ & (bfd_signed_vma) 0xff) << 8;
x |= (*codep++ & (bfd_signed_vma) 0xff) << 16;
{
bfd_signed_vma x = 0;
- FETCH_DATA (the_info, codep + 4);
+ fetch_data(the_info, codep + 4);
x = *codep++ & (bfd_signed_vma) 0xff;
x |= (*codep++ & (bfd_signed_vma) 0xff) << 8;
x |= (*codep++ & (bfd_signed_vma) 0xff) << 16;
{
int x = 0;
- FETCH_DATA (the_info, codep + 2);
+ fetch_data(the_info, codep + 2);
x = *codep++ & 0xff;
x |= (*codep++ & 0xff) << 8;
return x;
switch (bytemode)
{
case b_mode:
- FETCH_DATA (the_info, codep + 1);
+ fetch_data(the_info, codep + 1);
op = *codep++;
mask = 0xff;
break;
switch (bytemode)
{
case b_mode:
- FETCH_DATA (the_info, codep + 1);
+ fetch_data(the_info, codep + 1);
op = *codep++;
mask = 0xff;
break;
switch (bytemode)
{
case b_mode:
- FETCH_DATA (the_info, codep + 1);
+ fetch_data(the_info, codep + 1);
op = *codep++;
if ((op & 0x80) != 0)
op -= 0x100;
switch (bytemode)
{
case b_mode:
- FETCH_DATA (the_info, codep + 1);
+ fetch_data(the_info, codep + 1);
disp = *codep++;
if ((disp & 0x80) != 0)
disp -= 0x100;
{
const char *mnemonic;
- FETCH_DATA (the_info, codep + 1);
+ fetch_data(the_info, codep + 1);
/* AMD 3DNow! instructions are specified by an opcode suffix in the
place where an 8-bit immediate would normally go. ie. the last
byte of the instruction. */
{
unsigned int cmp_type;
- FETCH_DATA (the_info, codep + 1);
+ fetch_data(the_info, codep + 1);
obufp = obuf + strlen (obuf);
cmp_type = *codep++ & 0xff;
if (cmp_type < 8)