With HLE, the sequence REP LOCK actually makes sense, so support it.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
break;
case 0336:
- if (!ins->prefixes[PPS_LREP])
- ins->prefixes[PPS_LREP] = P_REP;
+ if (!ins->prefixes[PPS_REP])
+ ins->prefixes[PPS_REP] = P_REP;
break;
case 0337:
- if (!ins->prefixes[PPS_LREP])
- ins->prefixes[PPS_LREP] = P_REPNE;
+ if (!ins->prefixes[PPS_REP])
+ ins->prefixes[PPS_REP] = P_REPNE;
break;
case 0340:
!(ins->rex & (REX_P|REX_W|REX_X|REX_B)) &&
cpu >= IF_X86_64) {
/* LOCK-as-REX.R */
- assert_no_prefix(ins, PPS_LREP);
+ assert_no_prefix(ins, PPS_LOCK);
length++;
} else {
errfunc(ERR_NONFATAL, "invalid operands in non-64-bit mode");
}
if (lock) {
- if (ins->prefixes[PPS_LREP])
+ if (ins->prefixes[PPS_LOCK])
return false;
- ins->prefixes[PPS_LREP] = P_LOCK;
+ ins->prefixes[PPS_LOCK] = P_LOCK;
}
if (drep) {
- if (ins->prefixes[PPS_LREP])
+ if (ins->prefixes[PPS_REP])
return false;
- ins->prefixes[PPS_LREP] = drep;
+ ins->prefixes[PPS_REP] = drep;
}
ins->prefixes[PPS_WAIT] = dwait;
if (!o_used) {
* preferences, you can change this. REX prefixes are handled
* differently for the time being.
*
- * Note that LOCK and REP are in the same slot. This is
- * an x86 architectural constraint.
+ * LOCK and REP used to be one slot; this is no longer the case since
+ * the introduction of HLE.
*/
enum prefix_pos {
PPS_WAIT, /* WAIT (technically not a prefix!) */
- PPS_LREP, /* Lock or REP prefix */
+ PPS_REP, /* REP/HLE prefix */
+ PPS_LOCK, /* LOCK prefix */
PPS_SEG, /* Segment override prefix */
PPS_OSIZE, /* Operand size prefix */
PPS_ASIZE, /* Address size prefix */
case R_GS:
return PPS_SEG;
case P_LOCK:
+ return PPS_LOCK;
case P_REP:
case P_REPE:
case P_REPZ:
case P_REPNE:
case P_REPNZ:
- return PPS_LREP;
+ return PPS_REP;
case P_O16:
case P_O32:
case P_O64: