Fix VEX disassembling to ignore REX.RXBW bits in 32-bit mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140993 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Craig Topper
2011-10-03 07:51:09 +00:00
parent 1cbae18cf6
commit 7b22976de3

View File

@@ -407,11 +407,13 @@ static int readPrefixes(struct InternalInstruction* insn) {
/* We simulate the REX prefix for simplicity's sake */ /* We simulate the REX prefix for simplicity's sake */
if (insn->mode == MODE_64BIT) {
insn->rexPrefix = 0x40 insn->rexPrefix = 0x40
| (wFromVEX3of3(insn->vexPrefix[2]) << 3) | (wFromVEX3of3(insn->vexPrefix[2]) << 3)
| (rFromVEX2of3(insn->vexPrefix[1]) << 2) | (rFromVEX2of3(insn->vexPrefix[1]) << 2)
| (xFromVEX2of3(insn->vexPrefix[1]) << 1) | (xFromVEX2of3(insn->vexPrefix[1]) << 1)
| (bFromVEX2of3(insn->vexPrefix[1]) << 0); | (bFromVEX2of3(insn->vexPrefix[1]) << 0);
}
switch (ppFromVEX3of3(insn->vexPrefix[2])) switch (ppFromVEX3of3(insn->vexPrefix[2]))
{ {
@@ -444,8 +446,10 @@ static int readPrefixes(struct InternalInstruction* insn) {
insn->vexPrefix[0] = byte; insn->vexPrefix[0] = byte;
consumeByte(insn, &insn->vexPrefix[1]); consumeByte(insn, &insn->vexPrefix[1]);
if (insn->mode == MODE_64BIT) {
insn->rexPrefix = 0x40 insn->rexPrefix = 0x40
| (rFromVEX2of2(insn->vexPrefix[1]) << 2); | (rFromVEX2of2(insn->vexPrefix[1]) << 2);
}
switch (ppFromVEX2of2(insn->vexPrefix[1])) switch (ppFromVEX2of2(insn->vexPrefix[1]))
{ {
@@ -763,7 +767,7 @@ static int getID(struct InternalInstruction* insn) {
break; break;
} }
if (wFromVEX3of3(insn->vexPrefix[2])) if (insn->mode == MODE_64BIT && wFromVEX3of3(insn->vexPrefix[2]))
attrMask |= ATTR_REXW; attrMask |= ATTR_REXW;
if (lFromVEX3of3(insn->vexPrefix[2])) if (lFromVEX3of3(insn->vexPrefix[2]))
attrMask |= ATTR_VEXL; attrMask |= ATTR_VEXL;