x86: eliminate redundant REX prefixes in front of x86_64 instruction. bug reported by Aurélien Wailly
This commit is contained in:
parent
03a1836454
commit
1cbc222626
|
@ -390,6 +390,25 @@ static int readPrefixes(struct InternalInstruction* insn)
|
|||
bool hasAdSize = false;
|
||||
bool hasOpSize = false;
|
||||
|
||||
if (insn->mode == MODE_64BIT) {
|
||||
if (consumeByte(insn, &byte))
|
||||
return -1;
|
||||
|
||||
if ((byte & 0xf0) == 0x40) {
|
||||
while(true) {
|
||||
if (lookAtByte(insn, &byte)) // out of input code
|
||||
return -1;
|
||||
if ((byte & 0xf0) == 0x40) {
|
||||
// another REX prefix, but we only remember the last one
|
||||
consumeByte(insn, &byte);
|
||||
} else
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
unconsumeByte(insn);
|
||||
}
|
||||
}
|
||||
|
||||
while (isPrefix) {
|
||||
prefixLocation = insn->readerCursor;
|
||||
|
||||
|
|
Loading…
Reference in New Issue