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

Function tactic_B1

src/e9patch/e9tactics.cpp:452–464  ·  view source on GitHub ↗

* Tactic B1: replace the instruction with a jump. */

Source from the content-addressed store, hash-verified

450 * Tactic B1: replace the instruction with a jump.
451 */
452static Patch *tactic_B1(Binary &B, Instr *I, const Trampoline *T,
453 Tactic tactic = TACTIC_B1)
454{
455 if (I->size < JMP_SIZE || !option_tactic_B1 || !canPatch(I))
456 return nullptr;
457 const Alloc *A = allocateJump(B, I, T);
458 if (A == nullptr)
459 return nullptr;
460 Patch *P = new Patch(I, tactic, A);
461 patchJump(P, /*offset=*/0);
462 patchUnused(P, /*offset=sizeof(jmpq)=*/5);
463 return P;
464}
465
466/*
467 * Tactic B2: replace the instruction with a punned jump.

Callers 4

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

Calls 4

canPatchFunction · 0.85
allocateJumpFunction · 0.85
patchJumpFunction · 0.85
patchUnusedFunction · 0.85

Tested by

no test coverage detected