aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog8
-rw-r--r--opcodes/i386-dis.c33
2 files changed, 31 insertions, 10 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 58e48c6..82c6e01 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,11 @@
+2009-11-17 Quentin Neill <quentin.neill@amd.com>
+ Sebastian Pop <sebastian.pop@amd.com>
+
+ * i386-dis.c (get_vex_imm8): Increase bytes_before_imm when
+ decoding the second source operand from the immediate byte.
+ (OP_EX_VexW): Pass an extra integer to identify the second
+ and third source arguments.
+
2009-11-19 H.J. Lu <hongjiu.lu@intel.com>
* i386-opc.tbl: Add IsLockable to cmpxch16b.
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c
index a69f34f..a9bb2b1 100644
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -13691,7 +13691,7 @@ OP_VEX (int bytemode, int sizeflag ATTRIBUTE_UNUSED)
/* Get the VEX immediate byte without moving codep. */
static unsigned char
-get_vex_imm8 (int sizeflag)
+get_vex_imm8 (int sizeflag, int opnum)
{
int bytes_before_imm = 0;
@@ -13708,10 +13708,13 @@ get_vex_imm8 (int sizeflag)
{
FETCH_DATA (the_info, codep + 1);
base = *codep & 7;
- /* Don't increase bytes_before_imm as this has already
- been done in OP_E_memory. */
+ /* When decoding the third source, don't increase
+ bytes_before_imm as this has already been incremented
+ by one in OP_E_memory while decoding the second
+ source operand. */
+ if (opnum == 0)
+ bytes_before_imm++;
}
-
switch (modrm.mod)
{
case 0:
@@ -13725,8 +13728,13 @@ get_vex_imm8 (int sizeflag)
bytes_before_imm += 4;
break;
case 1:
- /* 1 byte displacement: codep has already been
- incremented by 1 in OP_E_memory. */
+ /* 1 byte displacement: when decoding the third source,
+ don't increase bytes_before_imm as this has already
+ been incremented by one in OP_E_memory while decoding
+ the second source operand. */
+ if (opnum == 0)
+ bytes_before_imm++;
+
break;
}
}
@@ -13744,8 +13752,13 @@ get_vex_imm8 (int sizeflag)
bytes_before_imm += 2;
break;
case 1:
- /* 1 byte displacement: codep has already been
- incremented by 1 in OP_E_memory. */
+ /* 1 byte displacement: when decoding the third source,
+ don't increase bytes_before_imm as this has already
+ been incremented by one in OP_E_memory while decoding
+ the second source operand. */
+ if (opnum == 0)
+ bytes_before_imm++;
+
break;
}
}
@@ -13856,12 +13869,12 @@ OP_EX_VexW (int bytemode, int sizeflag)
codep++;
if (vex.w)
- reg = get_vex_imm8 (sizeflag) >> 4;
+ reg = get_vex_imm8 (sizeflag, 0) >> 4;
}
else
{
if (!vex.w)
- reg = get_vex_imm8 (sizeflag) >> 4;
+ reg = get_vex_imm8 (sizeflag, 1) >> 4;
}
OP_EX_VexReg (bytemode, sizeflag, reg);