push in x86 code example
Example: pushad x86
// in c:
if(OperandSize = 32) { //PUSHAD instruction
Temporary = ESP;
Push(EAX);
Push(ECX);
Push(EDX);
Push(EBX);
Push(Temporary);
Push(EBP);
Push(ESI);
Push(EDI);
}
else { //OperandSize = 16, PUSHA instruction
Temporary = SP;
Push(AX);
Push(CX);
Push(DX);
Push(BX);
Push(Temporary);
Push(BP);
Push(SI);
Push(DI);
}