Skip to content

Commit

Permalink
Make pushad, pusha, and pushaw aliases of pushal
Browse files Browse the repository at this point in the history
pushal isn't a valid mnemonic, but it's what Capstone uses.
  • Loading branch information
hainest committed Nov 28, 2023
1 parent c8e04a3 commit 84c7c55
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 14 deletions.
6 changes: 4 additions & 2 deletions common/h/mnemonics/x86_entryIDs.h
Expand Up @@ -536,8 +536,10 @@ e_punpckldq,
e_punpcklqdq,
e_punpcklwd,
e_push,
e_pusha,
e_pushad,
e_pushal,
e_pusha = e_pushal,
e_pushad = e_pushal,
e_pushaw = e_pushal,
e_pushf,
e_pushfd,
e_pxor,
Expand Down
5 changes: 2 additions & 3 deletions common/src/arch-x86.C
Expand Up @@ -1317,8 +1317,7 @@ COMMON_EXPORT dyn_hash_map<entryID, std::string> entryNames_IAPI = map_list_of
(e_punpcklqdq, "punpcklqdq")
(e_punpcklwd, "punpcklwd")
(e_push, "push")
(e_pusha, "pusha")
(e_pushad, "pushad")
(e_pushal, "pusha")
(e_pushf, "pushf")
(e_pushfd, "pushfd")
(e_pxor, "pxor")
Expand Down Expand Up @@ -2335,7 +2334,7 @@ static ia32_entry oneByteMap[256] = {
{ e_pop, t_done, 0, false, { rSI, eSP, Zz }, 0, s1W2RW, s2I },
{ 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_pushal, t_done, 0, false, { GPRS, eSP, Zz }, 0, s1R2RW, 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 */
Expand Down
2 changes: 1 addition & 1 deletion dataflowAPI/src/RoseInsnFactory.C
Expand Up @@ -203,7 +203,7 @@ void RoseInsnX86Factory::massageOperands(const Instruction &insn,
case e_lodsw:
operands.clear();
break;
case e_pushad:
case e_pushal:
operands.clear();
break;
case e_loop:
Expand Down
4 changes: 1 addition & 3 deletions dataflowAPI/src/convertOpcodes.C
Expand Up @@ -768,9 +768,7 @@ X86InstructionKind RoseInsnX86Factory::convertKind(entryID opcode, prefixEntryID
return x86_punpcklwd;
case e_push:
return x86_push;
case e_pusha:
return x86_pusha;
case e_pushad:
case e_pushal:
return x86_pushad;
case e_pushf:
return x86_pushf;
Expand Down
2 changes: 1 addition & 1 deletion dataflowAPI/src/stackanalysis.C
Expand Up @@ -689,7 +689,7 @@ void StackAnalysis::computeInsnEffects(ParseAPI::Block *block,
case e_popfd:
handlePushPopFlags(sign, xferFuncs);
break;
case e_pushad:
case e_pushal:
sign = -1;
handlePushPopRegs(sign, xferFuncs);
break;
Expand Down
3 changes: 1 addition & 2 deletions instructionAPI/src/Operation.C
Expand Up @@ -340,8 +340,7 @@ namespace Dyninst
nonOperandMemoryReads.insert(make_pair(e_popal, 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));
nonOperandMemoryWrites.insert(make_pair(e_pushal, stackPointerAsExpr));
nonOperandMemoryWrites.insert(make_pair(e_call, stackPointerAsExpr));
nonOperandMemoryReads.insert(make_pair(e_ret_near, stackPointerAsExpr));
nonOperandMemoryReads.insert(make_pair(e_ret_far, stackPointerAsExpr));
Expand Down
3 changes: 1 addition & 2 deletions parseAPI/src/IA_x86.C
Expand Up @@ -557,8 +557,7 @@ bool IA_x86::isFakeCall() const
stackDelta += sign * size;
break;
}
case e_pusha:
case e_pushad:
case e_pushal:
sign = -1;
//FALLTHROUGH
case e_popal:
Expand Down

0 comments on commit 84c7c55

Please sign in to comment.