bool funcGuardMatches(TCA guard, const Func* func) { if (isPrologueStub(guard)) return false; const ppc64_asm::DecodedInstruction di(guard); auto const ifunc = reinterpret_cast<uintptr_t>(func); return static_cast<uintptr_t>(di.immediate()) == ifunc; }
TCA funcGuardFromPrologue(TCA prologue, const Func* /*func*/) { if (!isPrologueStub(prologue)) { // Typically a func guard is a smashable movq followed by an ldr, cmp, b.eq, // ldr, br, and a 32 bit target. However, relocation can shorten the sequence, // so search backwards until the smashable movq is found. for (int length = 0; length <= (5 * 4) + 4; length += 4) { TCA inst = prologue - (smashableMovqLen() + length); if (isSmashableMovq(inst)) return inst; } always_assert(false); } return prologue; }
TCA funcGuardFromPrologue(TCA prologue, const Func* func) { if (isPrologueStub(prologue)) return prologue; return (prologue - kFuncGuardLen); }
bool funcGuardMatches(TCA guard, const Func* func) { if (isPrologueStub(guard)) return false; return smashableMovqImm(guard) == reinterpret_cast<uintptr_t>(func); }
bool funcGuardMatches(TCA guard, const Func* func) { if (isPrologueStub(guard)) return false; auto const ifunc = reinterpret_cast<uintptr_t>(func); return static_cast<uintptr_t>(ppc64_asm::Assembler::getLi64(guard)) == ifunc; }