1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 03:28:20 +02:00

Fixed some Win32 and chkstk rollback issues

This commit is contained in:
Brian Fiete 2019-09-05 11:09:13 -07:00
parent 0ce6e44523
commit 8c21f24867
6 changed files with 86 additions and 46 deletions

View file

@ -151,9 +151,24 @@ int X86Instr::GetLength()
return mSize;
}
bool X86Instr::IsStackAdjust()
bool X86Instr::StackAdjust(uint32& adjust)
{
return mMCInst.getOpcode() == X86::SUB32ri8;
if (adjust == 0)
return true;
if (mMCInst.getOpcode() != X86::SUB32ri8)
return true;
auto operand0 = mMCInst.getOperand(0);
if (operand0.getReg() != llvm::X86::ESP)
return true;
auto operand2 = mMCInst.getOperand(2);
if (!operand2.isImm())
return false;
adjust -= (uint32)operand2.getImm();
return true;
}
bool X86Instr::IsBranch()