disasm: Fix for disassembly of BOUND

The opcode for BOUND, 62h, has a different meaning in long mode - it is the
prefix for EVEX instructions. ndisasm did not take this into account and always
tried to disassemble 62h back to an EVEX instruction.

Attached patch only permits EVEX disassembly if bitness is 64.
In 16/32 bit mode 62h will be not be a prefix and so disassemble
to BOUND.

Signed-off-by: Mark Scott <nasm@mscott.cx>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
Mark Scott 2015-11-03 23:09:05 +03:00 committed by Cyrill Gorcunov
parent be8a5c8f2d
commit db6ecf9b76

View File

@ -1216,7 +1216,7 @@ int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize,
case 0x62:
{
uint8_t evex_p0 = data[1] & 0x0f;
if (segsize == 64 ||
if (segsize == 64 &&
((evex_p0 >= 0x01) && (evex_p0 <= 0x03))) {
data++; /* 62h EVEX prefix */
prefix.evex[0] = *data++;