summaryrefslogtreecommitdiff
path: root/disasm.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2011-08-22 14:09:04 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2011-08-22 14:09:04 -0700
commit57078f061d6e3da2d7195debdfe1ac897e86799a (patch)
tree96703dec8b8d63090e71c582b35bf57e3285392e /disasm.c
parent9f2043eaad9b014f9f9d093cc0bd2137af543de1 (diff)
downloadnasm-57078f061d6e3da2d7195debdfe1ac897e86799a.tar.gz
nasm-57078f061d6e3da2d7195debdfe1ac897e86799a.tar.bz2
nasm-57078f061d6e3da2d7195debdfe1ac897e86799a.zip
disasm.c: ESP/RSP cannot be indicies, but XMM4/YMM4 can be
If we have XMM4/YMM4 as a VSIB, it does not mean no index; that is only for scalar encoding. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'disasm.c')
-rw-r--r--disasm.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/disasm.c b/disasm.c
index e9d1763..66ea7b0 100644
--- a/disasm.c
+++ b/disasm.c
@@ -331,12 +331,12 @@ static uint8_t *do_ea(uint8_t *data, int modrm, int asize,
op->scale = 1 << scale;
- if (index == 4 && !(rex & REX_X))
- op->indexreg = -1; /* ESP/RSP cannot be an index */
- else if (type == EA_XMMVSIB)
+ if (type == EA_XMMVSIB)
op->indexreg = nasm_rd_xmmreg[index | ((rex & REX_X) ? 8 : 0)];
else if (type == EA_YMMVSIB)
op->indexreg = nasm_rd_ymmreg[index | ((rex & REX_X) ? 8 : 0)];
+ else if (index == 4 && !(rex & REX_X))
+ op->indexreg = -1; /* ESP/RSP cannot be an index */
else if (a64)
op->indexreg = nasm_rd_reg64[index | ((rex & REX_X) ? 8 : 0)];
else