Diff for /qemu/m68k-dis.c between versions 1.1.1.4 and 1.1.1.5

version 1.1.1.4, 2018/04/24 17:21:22 version 1.1.1.5, 2018/04/24 18:24:41
Line 572  static const char *const reg_half_names[ Line 572  static const char *const reg_half_names[
 #endif  #endif
   
 /* Get a 1 byte signed integer.  */  /* Get a 1 byte signed integer.  */
 #define NEXTBYTE(p)  (p += 2, FETCH_DATA (info, p), COERCE_SIGNED_CHAR(p[-1]))  #define NEXTBYTE(p)  (p += 2, fetch_data(info, p), COERCE_SIGNED_CHAR(p[-1]))
   
 /* Get a 2 byte signed integer.  */  /* Get a 2 byte signed integer.  */
 #define COERCE16(x) ((int) (((x) ^ 0x8000) - 0x8000))  #define COERCE16(x) ((int) (((x) ^ 0x8000) - 0x8000))
 #define NEXTWORD(p)  \  #define NEXTWORD(p)  \
   (p += 2, FETCH_DATA (info, p), \    (p += 2, fetch_data(info, p), \
    COERCE16 ((p[-2] << 8) + p[-1]))     COERCE16 ((p[-2] << 8) + p[-1]))
   
 /* Get a 4 byte signed integer.  */  /* Get a 4 byte signed integer.  */
 #define COERCE32(x) ((bfd_signed_vma) ((x) ^ 0x80000000) - 0x80000000)  #define COERCE32(x) ((bfd_signed_vma) ((x) ^ 0x80000000) - 0x80000000)
 #define NEXTLONG(p)  \  #define NEXTLONG(p)  \
   (p += 4, FETCH_DATA (info, p), \    (p += 4, fetch_data(info, p), \
    (COERCE32 ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1])))     (COERCE32 ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1])))
   
 /* Get a 4 byte unsigned integer.  */  /* Get a 4 byte unsigned integer.  */
 #define NEXTULONG(p)  \  #define NEXTULONG(p)  \
   (p += 4, FETCH_DATA (info, p), \    (p += 4, fetch_data(info, p), \
    (unsigned int) ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1]))     (unsigned int) ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1]))
   
 /* Get a single precision float.  */  /* Get a single precision float.  */
 #define NEXTSINGLE(val, p) \  #define NEXTSINGLE(val, p) \
   (p += 4, FETCH_DATA (info, p), \    (p += 4, fetch_data(info, p), \
    floatformat_to_double (&floatformat_ieee_single_big, (char *) p - 4, &val))     floatformat_to_double (&floatformat_ieee_single_big, (char *) p - 4, &val))
   
 /* Get a double precision float.  */  /* Get a double precision float.  */
 #define NEXTDOUBLE(val, p) \  #define NEXTDOUBLE(val, p) \
   (p += 8, FETCH_DATA (info, p), \    (p += 8, fetch_data(info, p), \
    floatformat_to_double (&floatformat_ieee_double_big, (char *) p - 8, &val))     floatformat_to_double (&floatformat_ieee_double_big, (char *) p - 8, &val))
   
 /* Get an extended precision float.  */  /* Get an extended precision float.  */
 #define NEXTEXTEND(val, p) \  #define NEXTEXTEND(val, p) \
   (p += 12, FETCH_DATA (info, p), \    (p += 12, fetch_data(info, p), \
    floatformat_to_double (&floatformat_m68881_ext, (char *) p - 12, &val))     floatformat_to_double (&floatformat_m68881_ext, (char *) p - 12, &val))
   
 /* Need a function to convert from packed to double  /* Need a function to convert from packed to double
Line 611  static const char *const reg_half_names[ Line 611  static const char *const reg_half_names[
    packed number than a double anyway, so maybe     packed number than a double anyway, so maybe
    there should be a special case to handle this... */     there should be a special case to handle this... */
 #define NEXTPACKED(p) \  #define NEXTPACKED(p) \
   (p += 12, FETCH_DATA (info, p), 0.0)    (p += 12, fetch_data(info, p), 0.0)
   
 /* Maximum length of an instruction.  */  /* Maximum length of an instruction.  */
 #define MAXLEN 22  #define MAXLEN 22
Line 630  struct private Line 630  struct private
 /* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive)  /* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive)
    to ADDR (exclusive) are valid.  Returns 1 for success, longjmps     to ADDR (exclusive) are valid.  Returns 1 for success, longjmps
    on error.  */     on error.  */
 #define FETCH_DATA(info, addr) \  
   ((addr) <= ((struct private *) (info->private_data))->max_fetched \  
    ? 1 : fetch_data ((info), (addr)))  
   
 static int  static int
 fetch_data (struct disassemble_info *info, bfd_byte *addr)  fetch_data2(struct disassemble_info *info, bfd_byte *addr)
 {  {
   int status;    int status;
   struct private *priv = (struct private *)info->private_data;    struct private *priv = (struct private *)info->private_data;
Line 654  fetch_data (struct disassemble_info *inf Line 650  fetch_data (struct disassemble_info *inf
     priv->max_fetched = addr;      priv->max_fetched = addr;
   return 1;    return 1;
 }  }
   
   static int
   fetch_data(struct disassemble_info *info, bfd_byte *addr)
   {
       if (addr <= ((struct private *) (info->private_data))->max_fetched) {
           return 1;
       } else {
           return fetch_data2(info, addr);
       }
   }
   
 /* This function is used to print to the bit-bucket.  */  /* This function is used to print to the bit-bucket.  */
 static int  static int
 dummy_printer (FILE *file ATTRIBUTE_UNUSED,  dummy_printer (FILE *file ATTRIBUTE_UNUSED,
Line 728  fetch_arg (unsigned char *buffer, Line 734  fetch_arg (unsigned char *buffer,
       break;        break;
   
     case 'k':      case 'k':
       FETCH_DATA (info, buffer + 3);        fetch_data(info, buffer + 3);
       val = (buffer[3] >> 4);        val = (buffer[3] >> 4);
       break;        break;
   
     case 'C':      case 'C':
       FETCH_DATA (info, buffer + 3);        fetch_data(info, buffer + 3);
       val = buffer[3];        val = buffer[3];
       break;        break;
   
     case '1':      case '1':
       FETCH_DATA (info, buffer + 3);        fetch_data(info, buffer + 3);
       val = (buffer[2] << 8) + buffer[3];        val = (buffer[2] << 8) + buffer[3];
       val >>= 12;        val >>= 12;
       break;        break;
   
     case '2':      case '2':
       FETCH_DATA (info, buffer + 3);        fetch_data(info, buffer + 3);
       val = (buffer[2] << 8) + buffer[3];        val = (buffer[2] << 8) + buffer[3];
       val >>= 6;        val >>= 6;
       break;        break;
   
     case '3':      case '3':
     case 'j':      case 'j':
       FETCH_DATA (info, buffer + 3);        fetch_data(info, buffer + 3);
       val = (buffer[2] << 8) + buffer[3];        val = (buffer[2] << 8) + buffer[3];
       break;        break;
   
     case '4':      case '4':
       FETCH_DATA (info, buffer + 5);        fetch_data(info, buffer + 5);
       val = (buffer[4] << 8) + buffer[5];        val = (buffer[4] << 8) + buffer[5];
       val >>= 12;        val >>= 12;
       break;        break;
   
     case '5':      case '5':
       FETCH_DATA (info, buffer + 5);        fetch_data(info, buffer + 5);
       val = (buffer[4] << 8) + buffer[5];        val = (buffer[4] << 8) + buffer[5];
       val >>= 6;        val >>= 6;
       break;        break;
   
     case '6':      case '6':
       FETCH_DATA (info, buffer + 5);        fetch_data(info, buffer + 5);
       val = (buffer[4] << 8) + buffer[5];        val = (buffer[4] << 8) + buffer[5];
       break;        break;
   
     case '7':      case '7':
       FETCH_DATA (info, buffer + 3);        fetch_data(info, buffer + 3);
       val = (buffer[2] << 8) + buffer[3];        val = (buffer[2] << 8) + buffer[3];
       val >>= 7;        val >>= 7;
       break;        break;
   
     case '8':      case '8':
       FETCH_DATA (info, buffer + 3);        fetch_data(info, buffer + 3);
       val = (buffer[2] << 8) + buffer[3];        val = (buffer[2] << 8) + buffer[3];
       val >>= 10;        val >>= 10;
       break;        break;
   
     case '9':      case '9':
       FETCH_DATA (info, buffer + 3);        fetch_data(info, buffer + 3);
       val = (buffer[2] << 8) + buffer[3];        val = (buffer[2] << 8) + buffer[3];
       val >>= 5;        val >>= 5;
       break;        break;
Line 1104  print_insn_arg (const char *d, Line 1110  print_insn_arg (const char *d,
       {        {
         static const char *const cacheFieldName[] = { "nc", "dc", "ic", "bc" };          static const char *const cacheFieldName[] = { "nc", "dc", "ic", "bc" };
         val = fetch_arg (buffer, place, 2, info);          val = fetch_arg (buffer, place, 2, info);
         (*info->fprintf_func) (info->stream, cacheFieldName[val]);          (*info->fprintf_func) (info->stream, "%s", cacheFieldName[val]);
         break;          break;
       }        }
   
Line 1199  print_insn_arg (const char *d, Line 1205  print_insn_arg (const char *d,
         {          {
           static const char *const scalefactor_name[] = { "<<", ">>" };            static const char *const scalefactor_name[] = { "<<", ">>" };
           val = fetch_arg (buffer, place, 1, info);            val = fetch_arg (buffer, place, 1, info);
           (*info->fprintf_func) (info->stream, scalefactor_name[val]);            (*info->fprintf_func) (info->stream, "%s", scalefactor_name[val]);
         }          }
       else        else
         {          {
Line 1793  match_insn_m68k (bfd_vma memaddr, Line 1799  match_insn_m68k (bfd_vma memaddr,
          this because we know exactly what the second word is, and we           this because we know exactly what the second word is, and we
          aren't going to print anything based on it.  */           aren't going to print anything based on it.  */
       p = buffer + 6;        p = buffer + 6;
       FETCH_DATA (info, p);        fetch_data(info, p);
       buffer[2] = buffer[4];        buffer[2] = buffer[4];
       buffer[3] = buffer[5];        buffer[3] = buffer[5];
     }      }
   
   FETCH_DATA (info, p);    fetch_data(info, p);
   
   d = best->args;    d = best->args;
   
   save_p = p;    save_p = p;
   info->print_address_func = dummy_print_address;    info->print_address_func = dummy_print_address;
   info->fprintf_func = (fprintf_ftype) dummy_printer;    info->fprintf_func = dummy_printer;
   
   /* We scan the operands twice.  The first time we don't print anything,    /* We scan the operands twice.  The first time we don't print anything,
      but look for errors.  */       but look for errors.  */
Line 1963  print_insn_m68k (bfd_vma memaddr, disass Line 1969  print_insn_m68k (bfd_vma memaddr, disass
       break;        break;
     }      }
   
   FETCH_DATA (info, buffer + 2);    fetch_data(info, buffer + 2);
   major_opcode = (buffer[0] >> 4) & 15;    major_opcode = (buffer[0] >> 4) & 15;
   
   for (i = 0; i < numopcodes[major_opcode]; i++)    for (i = 0; i < numopcodes[major_opcode]; i++)
Line 1977  print_insn_m68k (bfd_vma memaddr, disass Line 1983  print_insn_m68k (bfd_vma memaddr, disass
           /* Only fetch the next two bytes if we need to.  */            /* Only fetch the next two bytes if we need to.  */
           && (((0xffff & match) == 0)            && (((0xffff & match) == 0)
               ||                ||
               (FETCH_DATA (info, buffer + 4)                (fetch_data(info, buffer + 4)
                && ((0xff & buffer[2] & (match >> 8)) == (0xff & (opcode >> 8)))                 && ((0xff & buffer[2] & (match >> 8)) == (0xff & (opcode >> 8)))
                && ((0xff & buffer[3] & match) == (0xff & opcode)))                 && ((0xff & buffer[3] & match) == (0xff & opcode)))
               )                )

Removed from v.1.1.1.4  
changed lines
  Added in v.1.1.1.5


unix.superglobalmegacorp.com