MCPcopy Create free account
hub / github.com/KasperskyLab/hrtng / PostHandleTwoPreds

Function PostHandleTwoPreds

src/unflat.cpp:1633–1658  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1631 }
1632
1633 void PostHandleTwoPreds(DeferredGraphModifier& dgm, mblock_t* mb, int oldTarget, int actualDfltTarget, mblock_t* nonJcc, int actualNonJccTarget)
1634 {
1635 MSG_UF3(("[I] %a: PostHandleTwoPreds mb:%d->%d (old %d), nJcc:%d->%d\n", mb->start, mb->serial, actualDfltTarget, oldTarget, nonJcc->serial, actualNonJccTarget));
1636 const bool bJcond = mb->tail != NULL && is_mcode_jcond(mb->tail->opcode);
1637 // handle endWithJcc's destination (actualDfltTarget)
1638 if (bJcond && actualDfltTarget == mb->serial + 1) { // we can not change the jump target to be the next block
1639 MSG_UF1(("[E] %a: PostHandleTwoPreds: actualDfltTarget is matched with the false case of the dispatcher predecessor %d. Abort.\n", mb->start, mb->serial));
1640 return;
1641 }
1642 dgm.ChangeGoto(mb, oldTarget, actualDfltTarget);
1643
1644 // this is not flattened if-statement blocks. Abort.
1645 if (actualDfltTarget == actualNonJccTarget) {
1646 MSG_UF2(("[W] %a: PostHandleTwoPreds: actualDfltTarget is matched with actualNonJccTarget in the dispatcher predecessor %d.\n", mb->start, mb->serial));
1647 return;
1648 }
1649
1650 // handle nonJcc
1651 if (bJcond) {
1652 // copy the conditional blocks for nonJcc
1653 CopyBlocksAndConnectPredNDest(dgm, mb, nonJcc, actualNonJccTarget);
1654 } else {
1655 // change the destination from mb->serial to actualNonJccTarget
1656 AppendInsnCopyAndConnect(dgm, mb, nonJcc, actualNonJccTarget);
1657 }
1658 }
1659
1660 // ida changes number of stopBlk on inserting new block (CopyMblock), renumbers sucessors/predecessors of moved block
1661 // but not changes microcode to correlate changed sucessors

Callers 1

runFunction · 0.85

Calls 2

AppendInsnCopyAndConnectFunction · 0.85

Tested by

no test coverage detected