/* ----------------------------------------------------------------------- *
*
- * Copyright 1996-2011 The NASM Authors - All Rights Reserved
+ * Copyright 1996-2012 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
*
* t = 0 for VEX (C4/C5), t = 1 for XOP (8F).
*
+ * \271 - instruction takes XRELEASE (F3) with or without lock
+ * \272 - instruction takes XACQUIRE/XRELEASE with or without lock
+ * \273 - instruction takes XACQUIRE/XRELEASE with lock only
* \274..\277 - a signed byte immediate operand, from operand 0..3,
* which is to be extended to the operand size.
* \310 - indicates fixed 16-bit address size, i.e. optional 0x67.
break;
case P_REPNE:
case P_REPNZ:
+ case P_XACQUIRE:
c = 0xF2;
break;
case P_REPE:
case P_REPZ:
case P_REP:
+ case P_XRELEASE:
c = 0xF3;
break;
case R_CS:
return v >= -128 && v <= 127;
}
+static void bad_hle_warn(const insn * ins, uint8_t hleok)
+{
+ enum prefixes rep_pfx = ins->prefixes[PPS_REP];
+ enum whatwarn { w_none, w_lock, w_inval };
+ static const enum whatwarn warn[2][4] =
+ {
+ { w_inval, w_inval, w_none, w_lock }, /* XACQUIRE */
+ { w_inval, w_none, w_none, w_lock }, /* XRELEASE */
+ };
+ unsigned int n;
+
+ n = (unsigned int)rep_pfx - P_XACQUIRE;
+ if (n > 1)
+ return; /* Not XACQUIRE/XRELEASE */
+
+ switch (warn[n][hleok]) {
+ case w_none:
+ break;
+
+ case w_lock:
+ if (ins->prefixes[PPS_LOCK] != P_LOCK) {
+ errfunc(ERR_WARNING | ERR_PASS2,
+ "%s with this instruction requires lock",
+ prefix_name(rep_pfx));
+ }
+ break;
+
+ case w_inval:
+ errfunc(ERR_WARNING | ERR_PASS2,
+ "%s invalid with this instruction",
+ prefix_name(rep_pfx));
+ break;
+ }
+}
+
/* Common construct */
#define case4(x) case (x): case (x)+1: case (x)+2: case (x)+3
struct operand *opx;
uint8_t opex = 0;
enum ea_type eat;
+ uint8_t hleok = 0;
ins->rex = 0; /* Ensure REX is reset */
eat = EA_SCALAR; /* Expect a scalar EA */
ins->vex_wlp = *codes++;
break;
+ case 0271:
+ case 0272:
+ case 0273:
+ hleok = c & 3;
+ break;
+
case4(0274):
length++;
break;
return -1;
}
}
+
+ bad_hle_warn(ins, hleok);
return length;
}
break;
}
+ case 0271:
+ if (prefix->rep == 0xF3)
+ drep = P_XRELEASE;
+ break;
+
+ case 0272:
+ if (prefix->rep == 0xF2)
+ drep = P_XACQUIRE;
+ else if (prefix->rep == 0xF3)
+ drep = P_XRELEASE;
+ break;
+
+ case 0273:
+ if (prefix->lock == 0xF0) {
+ if (prefix->rep == 0xF2)
+ drep = P_XACQUIRE;
+ else if (prefix->rep == 0xF3)
+ drep = P_XRELEASE;
+ }
+ break;
+
case 0310:
if (asize != 16)
return false;
push(@codes, 0325);
} elsif ($op eq 'wait') { # Needs a wait prefix
push(@codes, 0341);
+ } elsif ($op eq 'hlexr') {
+ push(@codes, 0271);
+ } elsif ($op eq 'hlenl') {
+ push(@codes, 0272);
+ } elsif ($op eq 'hle') {
+ push(@codes, 0273);
} elsif ($op eq 'vsibx' || $op eq 'vm32x' || $op eq 'vm64x') {
# This instruction takes XMM VSIB
push(@codes, 0374);
/* ----------------------------------------------------------------------- *
*
- * Copyright 1996-2011 The NASM Authors - All Rights Reserved
+ * Copyright 1996-2012 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
P_A16 = PREFIX_ENUM_START, P_A32, P_A64, P_ASP,
P_LOCK, P_O16, P_O32, P_O64, P_OSP,
P_REP, P_REPE, P_REPNE, P_REPNZ, P_REPZ, P_TIMES,
- P_WAIT,
+ P_WAIT, P_XACQUIRE, P_XRELEASE,
PREFIX_ENUM_LIMIT
};
/* ----------------------------------------------------------------------- *
*
- * Copyright 1996-2010 The NASM Authors - All Rights Reserved
+ * Copyright 1996-2012 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
*/
static const char *prefix_names[] = {
"a16", "a32", "a64", "asp", "lock", "o16", "o32", "o64", "osp",
- "rep", "repe", "repne", "repnz", "repz", "times", "wait"
+ "rep", "repe", "repne", "repnz", "repz", "times", "wait",
+ "xacquire", "xrelease"
};
const char *prefix_name(int token)
case P_REPZ:
case P_REPNE:
case P_REPNZ:
+ case P_XACQUIRE:
+ case P_XRELEASE:
return PPS_REP;
case P_O16:
case P_O32:
## --------------------------------------------------------------------------
##
-## Copyright 1996-2009 The NASM Authors - All Rights Reserved
+## Copyright 1996-2012 The NASM Authors - All Rights Reserved
## See the file AUTHORS included with the NASM distribution for
## the specific copyright holders.
##
repz
times
wait
+xacquire
+xrelease
% TOKEN_SPECIAL, 0, S_*
abs