Skip to content

Commit

Permalink
Make popad an alias of popaw
Browse files Browse the repository at this point in the history
popaw isn't a valid mnemonic, but it's what Capstone uses.
  • Loading branch information
hainest committed Nov 28, 2023
1 parent 9c645fb commit fe6cb30
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion common/h/mnemonics/x86_entryIDs.h
Expand Up @@ -486,7 +486,8 @@ e_pmuludq,
e_pop,
e_popal,
e_popa = e_popal,
e_popad,
e_popaw,
e_popad = e_popaw,
e_popcnt,
e_popf,
e_popfd,
Expand Down
4 changes: 2 additions & 2 deletions common/src/arch-x86.C
Expand Up @@ -1268,7 +1268,7 @@ COMMON_EXPORT dyn_hash_map<entryID, std::string> entryNames_IAPI = map_list_of
(e_pmuludq, "pmuludq")
(e_pop, "pop")
(e_popal, "popa")
(e_popad, "popad")
(e_popaw, "popad")
(e_popcnt, "popcnt")
(e_popf, "popf")
(e_popfd, "popfd")
Expand Down Expand Up @@ -2336,7 +2336,7 @@ static ia32_entry oneByteMap[256] = {
{ e_pop, t_done, 0, false, { rDI, eSP, Zz }, 0, s1W2RW, s2I },
/* 60 */
{ e_pushad, t_done, 0, false, { GPRS, eSP, Zz }, 0, s1R2RW, s2I },
{ e_popad, t_done, 0, false, { GPRS, eSP, Zz }, 0, s1W2RW, s2I },
{ e_popaw, t_done, 0, false, { GPRS, eSP, Zz }, 0, s1W2RW, s2I },
{ e_bound, t_done, 0, true, { Gv, Ma, Zz }, 0, s1R2R, 0 }, // or VEX
{ e_arpl, t_done, 0, true, { Ew, Gw, Zz }, 0, s1R2R, 0 }, /* No REX */
{ e_No_Entry, t_ill, 0, false, { Zz, Zz, Zz }, 0, 0, 0 }, // PREFIX_SEG_OVR
Expand Down
2 changes: 1 addition & 1 deletion dataflowAPI/src/RoseInsnFactory.C
Expand Up @@ -193,7 +193,7 @@ void RoseInsnX86Factory::massageOperands(const Instruction &insn,
// Nada
operands.clear();
break;
case e_popad:
case e_popaw:
case e_pushfd:
operands.clear();
break;
Expand Down
2 changes: 1 addition & 1 deletion dataflowAPI/src/convertOpcodes.C
Expand Up @@ -694,7 +694,7 @@ X86InstructionKind RoseInsnX86Factory::convertKind(entryID opcode, prefixEntryID
return x86_pop;
case e_popal:
return x86_popa;
case e_popad:
case e_popaw:
return x86_popad;
case e_popf:
return x86_popf;
Expand Down
2 changes: 1 addition & 1 deletion dataflowAPI/src/stackanalysis.C
Expand Up @@ -693,7 +693,7 @@ void StackAnalysis::computeInsnEffects(ParseAPI::Block *block,
sign = -1;
handlePushPopRegs(sign, xferFuncs);
break;
case e_popad:
case e_popaw:
// This nukes all registers
handleDefault(insn, block, off, xferFuncs);
break;
Expand Down
2 changes: 1 addition & 1 deletion instructionAPI/src/Operation.C
Expand Up @@ -338,7 +338,7 @@ namespace Dyninst

nonOperandMemoryReads.insert(make_pair(e_pop, stackPointerAsExpr));
nonOperandMemoryReads.insert(make_pair(e_popal, stackPointerAsExpr));
nonOperandMemoryReads.insert(make_pair(e_popad, stackPointerAsExpr));
nonOperandMemoryReads.insert(make_pair(e_popaw, stackPointerAsExpr));
nonOperandMemoryWrites.insert(make_pair(e_push, stackPointerAsExpr));
nonOperandMemoryWrites.insert(make_pair(e_pusha, stackPointerAsExpr));
nonOperandMemoryWrites.insert(make_pair(e_pushad, stackPointerAsExpr));
Expand Down
2 changes: 1 addition & 1 deletion parseAPI/src/IA_x86.C
Expand Up @@ -562,7 +562,7 @@ bool IA_x86::isFakeCall() const
sign = -1;
//FALLTHROUGH
case e_popal:
case e_popad:
case e_popaw:
if (1 == sign) {
mal_printf("popad ins'n at %lx in func at %lx changes sp "
"by %d. %s[%d]\n", ah->getAddr(),
Expand Down

0 comments on commit fe6cb30

Please sign in to comment.