Skip to content

Commit

Permalink
Update ARMPatch.cpp
Browse files Browse the repository at this point in the history
BLX for ARMv8
  • Loading branch information
RusJJ committed Jul 3, 2023
1 parent 700527c commit 4ad0268
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions armpatch_src/ARMPatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,14 @@ namespace ARMPatch
}
void WriteBL(uintptr_t addr, uintptr_t dest) // BL instruction
{
#ifdef __32BIT
uint32_t newDest = ((dest - addr - 4) >> 12) & 0x7FF | 0xF000 |
((((dest - addr - 4) >> 1) & 0x7FF | 0xF800) << 16);
Write(addr, (uintptr_t)&newDest, sizeof(uintptr_t));
#elif defined __64BIT
uint32_t newDest = 0x94000000 | (((dest - addr) >> 2) & 0x03FFFFFF);
Write(addr, (uintptr_t)&newDest, sizeof(uintptr_t));
#endif
}
void WriteBLX(uintptr_t addr, uintptr_t dest) // BLX instruction
{
Expand Down

0 comments on commit 4ad0268

Please sign in to comment.