Add symbolic constants for REX_V "classes" (VEX, XOP, ...)
authorH. Peter Anvin <hpa@zytor.com>
Sat, 9 May 2009 01:01:21 +0000 (18:01 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Sat, 9 May 2009 01:01:21 +0000 (18:01 -0700)
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
disasm.c
nasm.h

index a53fe0a..a48a015 100644 (file)
--- a/disasm.c
+++ b/disasm.c
@@ -1050,7 +1050,7 @@ int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize,
                prefix.vex[1] = *data++;
 
                prefix.rex = REX_V;
-               prefix.vex_c = 0;
+               prefix.vex_c = RV_VEX;
 
                if (prefix.vex[0] == 0xc4) {
                    prefix.vex[2] = *data++;
@@ -1066,7 +1066,7 @@ int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize,
                    prefix.vex_lp = prefix.vex[1] & 7;
                }
 
-               ix = itable_vex[0][prefix.vex_m][prefix.vex_lp];
+               ix = itable_vex[RV_VEX][prefix.vex_m][prefix.vex_lp];
            }
            end_prefix = true;
            break;
@@ -1079,7 +1079,7 @@ int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize,
                prefix.vex[2] = *data++;
 
                prefix.rex = REX_V;
-               prefix.vex_c = 1;
+               prefix.vex_c = RV_XOP;
 
                prefix.rex |= (~prefix.vex[1] >> 5) & 7; /* REX_RXB */
                prefix.rex |= (prefix.vex[2] >> (7-3)) & REX_W;
@@ -1087,7 +1087,7 @@ int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize,
                prefix.vex_v = (~prefix.vex[2] >> 3) & 15;
                prefix.vex_lp = prefix.vex[2] & 7;
 
-               ix = itable_vex[1][prefix.vex_m][prefix.vex_lp];
+               ix = itable_vex[RV_XOP][prefix.vex_m][prefix.vex_lp];
            }
            end_prefix = true;
            break;
diff --git a/nasm.h b/nasm.h
index 587ace8..e2677c2 100644 (file)
--- a/nasm.h
+++ b/nasm.h
@@ -602,6 +602,14 @@ enum ccode {                       /* condition code names */
 #define REX_V          0x0400  /* Instruction uses VEX/XOP instead of REX */
 
 /*
+ * REX_V "classes" (prefixes which behave like VEX)
+ */
+enum vex_class {
+    RV_VEX             = 0,    /* C4/C5 */
+    RV_XOP             = 1     /* 8F */
+};
+
+/*
  * Note that because segment registers may be used as instruction
  * prefixes, we must ensure the enumerations for prefixes and
  * register names do not overlap.