x86: properly handle lock/rep prefixes when DIET option is enable
This commit is contained in:
parent
9bcca47a98
commit
288d6b3c8a
|
@ -12497,9 +12497,11 @@ static void printInstruction(MCInst *MI, SStream *O, MCRegisterInfo *MRI)
|
|||
uint64_t Bits2 = OpInfo2[MCInst_getOpcode(MI)];
|
||||
uint64_t Bits = (Bits2 << 32) | Bits1;
|
||||
// assert(Bits != 0 && "Cannot print this instruction.");
|
||||
#ifndef CAPSTONE_DIET
|
||||
if (!X86_lockrep(MI, O))
|
||||
#ifndef CAPSTONE_DIET
|
||||
SStream_concat(O, "%s", AsmStrs+(Bits & 16383)-1);
|
||||
#else
|
||||
;
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -12201,9 +12201,11 @@ static void printInstruction(MCInst *MI, SStream *O, MCRegisterInfo *MRI)
|
|||
uint64_t Bits2 = OpInfo2[MCInst_getOpcode(MI)];
|
||||
uint64_t Bits = (Bits2 << 32) | Bits1;
|
||||
// assert(Bits != 0 && "Cannot print this instruction.");
|
||||
#ifndef CAPSTONE_DIET
|
||||
if (!X86_lockrep(MI, O))
|
||||
#ifndef CAPSTONE_DIET
|
||||
SStream_concat(O, "%s", AsmStrs+(Bits & 16383)-1);
|
||||
#else
|
||||
;
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -41706,7 +41706,6 @@ x86_reg X86_insn_reg(unsigned int id)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifndef CAPSTONE_DIET
|
||||
// return true if we patch the mnemonic
|
||||
bool X86_lockrep(MCInst *MI, SStream *O)
|
||||
{
|
||||
|
@ -41718,27 +41717,39 @@ bool X86_lockrep(MCInst *MI, SStream *O)
|
|||
default:
|
||||
break;
|
||||
case 0xf0:
|
||||
#ifndef CAPSTONE_DIET
|
||||
SStream_concat(O, "lock|");
|
||||
#endif
|
||||
break;
|
||||
case 0xf2:
|
||||
if (MI->Opcode == X86_MULPDrr) {
|
||||
MI->Opcode = X86_MULSDrr;
|
||||
#ifndef CAPSTONE_DIET
|
||||
SStream_concat(O, "mulsd\t");
|
||||
#endif
|
||||
MI->x86_prefix[i] = 0;
|
||||
// notify that we already patched mnemonic
|
||||
return true;
|
||||
} else
|
||||
}
|
||||
#ifndef CAPSTONE_DIET
|
||||
else
|
||||
SStream_concat(O, "repne|");
|
||||
#endif
|
||||
break;
|
||||
case 0xf3:
|
||||
if (MI->Opcode == X86_MULPDrr) {
|
||||
MI->Opcode = X86_MULSSrr;
|
||||
#ifndef CAPSTONE_DIET
|
||||
SStream_concat(O, "mulss\t");
|
||||
#endif
|
||||
MI->x86_prefix[i] = 0;
|
||||
// notify that we already patched mnemonic
|
||||
return true;
|
||||
} else
|
||||
}
|
||||
#ifndef CAPSTONE_DIET
|
||||
else
|
||||
SStream_concat(O, "rep|");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -41746,4 +41757,3 @@ bool X86_lockrep(MCInst *MI, SStream *O)
|
|||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -39,10 +39,8 @@ x86_reg X86_insn_reg(unsigned int id);
|
|||
|
||||
extern uint64_t arch_masks[9];
|
||||
|
||||
#ifndef CAPSTONE_DIET
|
||||
// handle LOCK/REP/REPNE prefixes
|
||||
// return True if we patch mnemonic, like in MULPD case
|
||||
bool X86_lockrep(MCInst *MI, SStream *O);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue