MERR_BADHLE,
MERR_ENCMISMATCH,
MERR_BADBND,
+ MERR_BADREPNE,
/*
* Matching success; the conditional ones first
*/
case P_EVEX:
case P_VEX3:
case P_VEX2:
+ case P_NOBND:
case P_none:
break;
default:
case MERR_BADBND:
error(ERR_NONFATAL, "bnd prefix is not allowed");
break;
+ case MERR_BADREPNE:
+ error(ERR_NONFATAL, "%s prefix is not allowed",
+ (has_prefix(instruction, PPS_REP, P_REPNE) ?
+ "repne" : "repnz"));
+ break;
default:
error(ERR_NONFATAL,
"invalid combination of opcode and operands");
case P_EVEX:
case P_VEX3:
case P_VEX2:
+ case P_NOBND:
case P_none:
break;
default:
bad_hle_warn(ins, hleok);
+ /*
+ * when BND prefix is set by DEFAULT directive,
+ * BND prefix is added to every appropriate instruction line
+ * unless it is overridden by NOBND prefix.
+ */
+ if (globalbnd &&
+ (itemp_has(temp, IF_BND) && !has_prefix(ins, PPS_REP, P_NOBND)))
+ ins->prefixes[PPS_REP] = P_BND;
+
return length;
}
return MOK_JUMP;
/*
- * Check if BND prefix is allowed
+ * Check if BND prefix is allowed.
+ * Other 0xF2 (REPNE/REPNZ) prefix is prohibited.
*/
if (!itemp_has(itemp, IF_BND) &&
- has_prefix(instruction, PPS_REP, P_BND))
+ (has_prefix(instruction, PPS_REP, P_BND) ||
+ has_prefix(instruction, PPS_REP, P_NOBND)))
return MERR_BADBND;
+ else if (itemp_has(itemp, IF_BND) &&
+ (has_prefix(instruction, PPS_REP, P_REPNE) ||
+ has_prefix(instruction, PPS_REP, P_REPNZ)))
+ return MERR_BADREPNE;
return MOK_GOOD;
}
int pass0, passn;
int maxbits = 0;
int globalrel = 0;
+int globalbnd = 0;
static time_t official_compile_time;
stdscan_reset();
stdscan_set(value);
tokval.t_type = TOKEN_INVALID;
- if (stdscan(NULL, &tokval) == TOKEN_SPECIAL) {
+ if (stdscan(NULL, &tokval) != TOKEN_INVALID) {
switch ((int)tokval.t_integer) {
case S_REL:
globalrel = 1;
case S_ABS:
globalrel = 0;
break;
+ case P_BND:
+ globalbnd = 1;
+ break;
+ case P_NOBND:
+ globalbnd = 0;
+ break;
default:
err = 1;
break;
P_XACQUIRE,
P_XRELEASE,
P_BND,
+ P_NOBND,
P_EVEX,
P_VEX3,
P_VEX2,
extern int optimizing;
extern int globalbits; /* 16, 32 or 64-bit mode */
extern int globalrel; /* default to relative addressing? */
+extern int globalbnd; /* default to using bnd prefix? */
extern int maxbits; /* max bits supported by output */
/*