Skip to content

Commit

Permalink
Update ARMPatch.cpp
Browse files Browse the repository at this point in the history
BLX is not available on ARMv8
  • Loading branch information
RusJJ committed Jul 3, 2023
1 parent 4ad0268 commit ab9c75c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions armpatch_src/ARMPatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,13 @@ namespace ARMPatch
}
void WriteBLX(uintptr_t addr, uintptr_t dest) // BLX instruction
{
#ifdef __32BIT
uint32_t newDest = ((dest - addr - 4) >> 12) & 0x7FF | 0xF000 |
((((dest - addr - 4) >> 1) & 0x7FF | 0xE800) << 16);
Write(addr, (uintptr_t)&newDest, sizeof(uintptr_t));
#elif defined __64BIT
__builtin_trap(); // ARMv8 doesnt have that instruction so using it is absurd!
#endif
}
int WriteRET(uintptr_t addr)
{
Expand Down

0 comments on commit ab9c75c

Please sign in to comment.