Commit-ID: db6ecf9b76a25c465887946fe70e74b3dcdce234
Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=db6ecf9b76a25c465887946fe70e74b3dcdce234
Author: Mark Scott <na...@ms...>
AuthorDate: Tue, 3 Nov 2015 23:09:05 +0300
Committer: Cyrill Gorcunov <gor...@gm...>
CommitDate: Tue, 3 Nov 2015 23:09:05 +0300
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 <na...@ms...>
Signed-off-by: Cyrill Gorcunov <gor...@gm...>
---
disasm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/disasm.c b/disasm.c
index e748483..da39632 100644
--- a/disasm.c
+++ b/disasm.c
@@ -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++;
|