summaryrefslogtreecommitdiff
path: root/disasm.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2010-08-19 16:59:35 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2010-08-19 16:59:35 -0700
commit23f0b16c21467aefd2b8ae5c507af902d102d39e (patch)
tree9697ac0cb84cc377fb29816cec6728e554ed9fba /disasm.c
parent7023d638de1db6cf3694ac81343101a1bcf6751e (diff)
downloadnasm-23f0b16c21467aefd2b8ae5c507af902d102d39e.tar.gz
nasm-23f0b16c21467aefd2b8ae5c507af902d102d39e.tar.bz2
nasm-23f0b16c21467aefd2b8ae5c507af902d102d39e.zip
ndisasm: unify VEX handling
Unify VEX handling between the 026x and 0270 bytecodes. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'disasm.c')
-rw-r--r--disasm.c40
1 files changed, 6 insertions, 34 deletions
diff --git a/disasm.c b/disasm.c
index f2ec76b..81282e6 100644
--- a/disasm.c
+++ b/disasm.c
@@ -685,6 +685,7 @@ static int matches(const struct itemplate *t, uint8_t *data,
break;
case4(0260):
+ case 0270:
{
int vexm = *r++;
int vexwlp = *r++;
@@ -717,42 +718,13 @@ static int matches(const struct itemplate *t, uint8_t *data,
if ((vexwlp ^ prefix->vex_lp) & ((vexwlp & 010) ? 03 : 07))
return false;
- opx->segment |= SEG_RMREG;
- opx->basereg = prefix->vex_v;
- vex_ok = true;
- break;
- }
-
- case 0270:
- {
- int vexm = *r++;
- int vexwlp = *r++;
- ins->rex |= REX_V;
- if ((prefix->rex & (REX_V|REX_D|REX_P)) != REX_V)
- return false;
-
- if ((vexm & 0x1f) != prefix->vex_m)
- return false;
-
- switch (vexwlp & 030) {
- case 000:
- if (ins->rex & REX_W)
+ if (c == 0270) {
+ if (prefix->vex_v != 0)
return false;
- break;
- case 010:
- if (!(ins->rex & REX_W))
- return false;
- break;
- default:
- break; /* Need to do anything special here? */
+ } else {
+ opx->segment |= SEG_RMREG;
+ opx->basereg = prefix->vex_v;
}
-
- if ((vexwlp & 007) != prefix->vex_lp)
- return false;
-
- if (prefix->vex_v != 0)
- return false;
-
vex_ok = true;
break;
}