MCPcopy Create free account
hub / github.com/GJDuck/e9patch / tactic_T1

Function tactic_T1

src/e9patch/e9tactics.cpp:497–517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

495 }
496}
497static Patch *tactic_T1(Binary &B, Instr *I, const Trampoline *T,
498 Tactic tactic = TACTIC_T1)
499{
500 if (I->size >= JMP_SIZE || !option_tactic_T1 || !canPatch(I))
501 return nullptr;
502 for (unsigned prefix = 1; prefix < JMP_REL32_SIZE && canApplyT1(I, prefix);
503 prefix++)
504 {
505 if (prefix >= I->size)
506 break;
507 const Alloc *A = allocatePunnedJump(B, I, prefix, I, T);
508 if (A != nullptr)
509 {
510 Patch *P = new Patch(I, tactic, A);
511 patchJumpPrefix(P, prefix);
512 patchJump(P, prefix);
513 return P;
514 }
515 }
516 return nullptr;
517}
518
519/*
520 * Tactic T2: evict the successor instruction.

Callers 5

tactic_T2Function · 0.85
tactic_T3bFunction · 0.85
tactic_T3Function · 0.85
tactic_T0Function · 0.85
patchFunction · 0.85

Calls 5

canPatchFunction · 0.85
canApplyT1Function · 0.85
allocatePunnedJumpFunction · 0.85
patchJumpPrefixFunction · 0.85
patchJumpFunction · 0.85

Tested by

no test coverage detected