summaryrefslogtreecommitdiff
path: root/insns.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-07-25 18:15:28 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-07-25 18:15:28 -0700
commita81655bffb3841a0326c7224403f8c8e7cccd82a (patch)
tree0d3f2da0698d2c8967b755c47416e0f6f2c9e4dc /insns.h
parent23595f5946bc816185204302a78d8413ed59cc4b (diff)
downloadnasm-a81655bffb3841a0326c7224403f8c8e7cccd82a.tar.gz
nasm-a81655bffb3841a0326c7224403f8c8e7cccd82a.tar.bz2
nasm-a81655bffb3841a0326c7224403f8c8e7cccd82a.zip
Enable fuzzy matching of operand sizes
This allows automatic fuzzy matching of operand sizes. If an operand size is not specified, but there is exactly one possible size for the instruction, select that instruction size. This requires a second pass through the instruction patterns, and so is slightly slower, but should be a lot easier to get right than the S- flags, and works even when there is more than one instruction. The new SX (Size eXact) flag can be used to prevent fuzzy matching completely. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'insns.h')
-rw-r--r--insns.h25
1 files changed, 14 insertions, 11 deletions
diff --git a/insns.h b/insns.h
index e8096a7..4ae2499 100644
--- a/insns.h
+++ b/insns.h
@@ -77,17 +77,20 @@ extern const uint8_t nasm_bytecodes[];
#define IF_SQ 0x00000010UL /* unsized operands can't be non-qword */
#define IF_SO 0x00000014UL /* unsized operands can't be non-oword */
#define IF_SY 0x00000018UL /* unsized operands can't be non-yword */
-#define IF_SZ 0x0000001CUL /* unsized operands must match the bitsize */
-#define IF_SMASK 0x0000001CUL /* mask for unsized argument size */
-#define IF_AR0 0x00000020UL /* SB, SW, SD applies to argument 0 */
-#define IF_AR1 0x00000040UL /* SB, SW, SD applies to argument 1 */
-#define IF_AR2 0x00000060UL /* SB, SW, SD applies to argument 2 */
-#define IF_AR3 0x00000080UL /* SB, SW, SD applies to argument 3 */
-#define IF_ARMASK 0x000000E0UL /* mask for unsized argument spec */
-#define IF_ARSHFT 5 /* LSB in IF_ARMASK */
-#define IF_PRIV 0x00000100UL /* it's a privileged instruction */
-#define IF_SMM 0x00000200UL /* it's only valid in SMM */
-#define IF_PROT 0x00000400UL /* it's protected mode only */
+#define IF_SZ 0x00000038UL /* unsized operands must match the bitsize */
+#define IF_SX 0x0000003CUL /* unsized operands not allowed */
+#define IF_SMASK 0x0000003CUL /* mask for unsized argument size */
+#define IF_AR0 0x00000040UL /* SB, SW, SD applies to argument 0 */
+#define IF_AR1 0x00000080UL /* SB, SW, SD applies to argument 1 */
+#define IF_AR2 0x000000C0UL /* SB, SW, SD applies to argument 2 */
+#define IF_AR3 0x00000100UL /* SB, SW, SD applies to argument 3 */
+#define IF_AR4 0x00000140UL /* SB, SW, SD applies to argument 4 */
+#define IF_ARMASK 0x000001C0UL /* mask for unsized argument spec */
+#define IF_ARSHFT 6 /* LSB in IF_ARMASK */
+/* The next 3 bits aren't actually used for anything */
+#define IF_PRIV 0x00000000UL /* it's a privileged instruction */
+#define IF_SMM 0x00000000UL /* it's only valid in SMM */
+#define IF_PROT 0x00000000UL /* it's protected mode only */
#define IF_NOLONG 0x00000800UL /* it's not available in long mode */
#define IF_UNDOC 0x00001000UL /* it's an undocumented instruction */
#define IF_FPU 0x00002000UL /* it's an FPU instruction */