x86: fix the issue with prefix instruction declared in 2.0's RELEASE_NOTES

This commit is contained in:
Nguyen Anh Quynh 2014-01-25 14:22:15 +08:00
parent 9389947d0d
commit 94020d8478
2 changed files with 13 additions and 4 deletions

15
cs.c
View File

@ -360,7 +360,7 @@ size_t cs_disasm_ex(csh ud, const uint8_t *buffer, size_t size, uint64_t offset,
c++;
} else {
// combine this instruction with previous prefix instruction
// combine this instruction with previous prefix "instruction"
cs_insn *prev = get_prev_insn(insn_cache, f, total, total_size);
handle->combine(handle, &insn_cache[f], prev);
}
@ -369,8 +369,17 @@ size_t cs_disasm_ex(csh ud, const uint8_t *buffer, size_t size, uint64_t offset,
size -= insn_size;
offset += insn_size;
if (count > 0 && c == count)
break;
if (count > 0) {
// x86 hacky
if (!handle->prev_prefix) {
if (c == count)
break;
} else {
// only combine 1 prefix with regular instruction
if (c == count + 1)
break;
}
}
} else {
// encounter a broken instruction
// XXX: TODO: JOXEAN continue here

View File

@ -73,7 +73,7 @@ for (arch, mode, comment, syntax) in all_tests:
try:
md = Cs(arch, mode)
#md.detail = True
md.detail = True
if syntax != 0:
md.syntax = syntax