arm/shared/KernelExploit/Sources/CFastFind/CFastFind.c
/**
 * Emulate a b/bl instruction at the given pc value
 * Returns branch destination
 */
Emulate a b/bl instruction at the given pc value
Returns branch destination
Emulate a b / bl instruction at the given pc value Returns branch destination
uint64_t aarch64_emulate_branch(uint32_t instruction, uint64_t pc) {
    if ((instruction & 0x7C000000) != 0x14000000) {
        return 0;
    }
    int32_t imm = (instruction & 0x3FFFFFF) << 2;
    if (instruction & 0x2000000) {
        imm |= 0xFC000000;
    }
    return pc + imm;
}
uint64_t aarch64_emulate_branch ( uint32_t instruction , uint64_t pc ) { if ( ( instruction & 0x7C000000 ) != 0x14000000 ) { return 0 ; } int32_t imm = ( instruction & 0x3FFFFFF ) << 2 ; if ( instruction & 0x2000000 ) { imm |= 0xFC000000 ; } return pc + imm ; }
Emulate a b/bl instruction at the given pc value
 Returns branch destination
Emulate a b / bl instruction at the given pc value Returns branch destination
// Check that this is a branch instruction // Sign extend // Emulate