Skip to content

Commit

Permalink
Prevent corruption to rax during stack alignment on x86-64
Browse files Browse the repository at this point in the history
  • Loading branch information
mxz297 committed Oct 2, 2019
1 parent b69554b commit cecd1a8
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions dyninstAPI/src/emit-x86.C
Original file line number Diff line number Diff line change
Expand Up @@ -2420,11 +2420,7 @@ void EmitterAMD64::emitStackAlign(int offset, codeGen &gen)
int saveSlot2 = 8 + AMD64_STACK_ALIGNMENT;

bool saveFlags = false;
Register scratch = gen.rs()->getScratchRegister(gen);
// If we cannot allocate a scratch register, use RAX.
// It will be restored at the end anyway
if (scratch == REG_NULL)
scratch = REGNUM_RAX;
Register scratch = REGNUM_RAX;

if (gen.rs()->checkVolatileRegisters(gen, registerSlot::live)) {
saveFlags = true; // We need to save the flags register
Expand Down

0 comments on commit cecd1a8

Please sign in to comment.