diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2015-11-05 01:14:05 +0300 |
---|---|---|
committer | Cyrill Gorcunov <gorcunov@gmail.com> | 2015-11-05 01:14:45 +0300 |
commit | a2a2d19f434380cd00fe31c9ea1734939eb2dadd (patch) | |
tree | 7fc4dd0cadbce7cd69adc90da3c4ec99a7722f1a /disasm.c | |
parent | 8aa9c2eb91b700a9dfdd587457d651f29499e816 (diff) | |
download | nasm-a2a2d19f434380cd00fe31c9ea1734939eb2dadd.tar.gz |
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 db6ecf9b76a2
Reported-by: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'disasm.c')
-rw-r--r-- | disasm.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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++; |