disasm: Fix disassembling of evex prefix

As been pointed by @hpa evex is pretty fine in ia-32.

Quoting Peter

 | This is wrong, though; EVEX is permitted in 32-bit mode just as VEX is.
 | The key thing is that bits [7:5] have to be 1 in 32-bit mode.  It is
 | unclear what happens if these bits are 110 as that depends on if it is
 | decoded using the modr/m decoder or not.  For VEX prefixes we accept
 | them as VEX in that case, which may not match the CPU.

This is a fix for commit db6ecf9b76

Reported-by: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
Cyrill Gorcunov 2015-11-05 01:14:05 +03:00
parent 8aa9c2eb91
commit a2a2d19f43

View File

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