------- Comment #4 from pinskia at gcc dot gnu dot org  2005-10-06 13:40 -------
Confirmed, reduced testcase:
typedef struct {
  int basereg, indexreg, scale;
  long segment;
  long offset;
} operand;
typedef struct extop {
  operand oprs[3];
} insn;
enum { I_CMOVcc,  I_Jcc,  I_SETcc };
struct itemplate {
  int opcode;
  int operands;
  long opd[3];
  const char *code;
};
static int ico[] = {
  I_CMOVcc,  I_Jcc,  I_SETcc
};
static int matches(struct itemplate *t, unsigned char *data, int asize,
                   int osize, int segsize, int rep, insn * ins)
{
  unsigned char *r = (unsigned char *)(t->code);
  unsigned char *origdata = data;
  while (*r) {
    int c = *r++;
    if (c >= 01 && c <= 03) {
      switch (*data++) {
        case 0x1F:
          return 0;
      }
    }
    if (c == 05) {
      switch (*data++) {
        case 0x06:
          ins->oprs[0].basereg = 1;
      }
    }
    if (c == 07) 
      data++;
    if (c >= 010 && c <= 012) 
      data++;
    if (c == 017)    
      data++;
    if (c >= 014 && c <= 016) 
      data++;
    if (c >= 020 && c <= 022) 
      data++;
    if (c >= 024 && c <= 026)
      data++;
    if (c >= 030 && c <= 032) 
      data++;
    if (c >= 034 && c <= 036) 
      data++;
    if (c >= 040 && c <= 042) 
      data++;
    if (c >= 044 && c <= 046) 
      data++;
    if (c >= 050 && c <= 052) 
      data++;
    if (c >= 060 && c <= 062) 
      data++;
    if (c >= 064 && c <= 066) 
      data++;
    if (c >= 070 && c <= 072) 
      data++;
    if (c >= 0100 && c < 0130) 
      data++;
    if (c >= 0130 && c <= 0132) 
      data++;
    if (c >= 0140 && c <= 0142) 
      data++;
    if (c >= 0200 && c <= 0277) 
      data++;
  }
  return data - origdata;
}
void disasm(unsigned char *data, char *output, int outbufsize, int segsize,
            long offset, int autosync, unsigned long prefer)
{
  struct itemplate **p, **best_p;
  int length, best_length = 0;
  int rep, lock, asize, osize, i, slen, colon;
  insn tmp_ins, ins;
  for (; *p; p++)
    if ((length = matches(*p, data, asize, osize, segsize, rep, &tmp_ins)))
      for (i = 0; i < (*p)->operands; i++)
        if (tmp_ins.oprs[i].segment & 4)
          break;
  for (i = 0; i < ( sizeof(ico) / sizeof(*(ico)) ); i++)
    if ((*p)->opcode == ico[i])
             break;
}


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.1.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24226

Reply via email to