VEX prefixes apply to VEX instructions only...

This commit is contained in:
H. Peter Anvin 2008-05-20 23:36:36 -07:00
parent c882715a8e
commit 6b3b7bcd33

View file

@ -372,6 +372,7 @@ static int matches(const struct itemplate *t, uint8_t *data,
int i, c; int i, c;
struct operand *opx; struct operand *opx;
int s_field_for = -1; /* No 144/154 series code encountered */ int s_field_for = -1; /* No 144/154 series code encountered */
bool vex_ok = false;
for (i = 0; i < MAX_OPERANDS; i++) { for (i = 0; i < MAX_OPERANDS; i++) {
ins->oprs[i].segment = ins->oprs[i].disp_size = ins->oprs[i].segment = ins->oprs[i].disp_size =
@ -714,6 +715,7 @@ static int matches(const struct itemplate *t, uint8_t *data,
opx->segment |= SEG_RMREG; opx->segment |= SEG_RMREG;
opx->basereg = prefix->vex_v; opx->basereg = prefix->vex_v;
vex_ok = true;
break; break;
} }
@ -747,6 +749,7 @@ static int matches(const struct itemplate *t, uint8_t *data,
if (prefix->vex_v != 0) if (prefix->vex_v != 0)
return false; return false;
vex_ok = true;
break; break;
} }
@ -920,6 +923,9 @@ static int matches(const struct itemplate *t, uint8_t *data,
} }
} }
if (!vex_ok && (ins->rex & REX_V))
return false;
/* REX cannot be combined with DREX or VEX */ /* REX cannot be combined with DREX or VEX */
if ((ins->rex & (REX_D|REX_V)) && (prefix->rex & REX_P)) if ((ins->rex & (REX_D|REX_V)) && (prefix->rex & REX_P))
return false; return false;