I'm trying to patch in some jump hooks for debugging. I'm finding it hard to work out efficient ARM assembly for this (I'm an ARM noob). In x86 I'd JMP 0x12345678 and it would be 5 bytes with no register side effects. ARM I can't set a dword constant in one go. I'm also in Thumb mode. Best I have so far is this, which kind of sucks:
PUSH {R3, R4}
MOV R4, 0x1234
MOV R3, 0x5678
LSL R4, R4, #16
ADD R4, R3
BX R4
Which is 18 bytes, feels bad to me. Some functions I'm interested in are the same size! Any better way to jump to an arbitrary offset? Maybe I'd win by swapping out of Thumb first?
Alternatively, any ideas on how to accomplish the same idea efficiently in ARM would be appreciated - patch in a transfer to my own code to do arbitrary stuff, then cleanup register & stack changes and transfer back.