Currently the default inline hook shim process seems to be:
1) Original instruction
2) move LR into R0
3) store LR and r3-31 to a stack frame as usual
4) jump
5) steps 2 & 3 in reverse.
However, this pattern means that if we hook an instruction (or series of instructions) that is using r0, we won't save that value. I think ideally we would also put the original r0 value into the stack frame that we are generating. I think the added safety is likely worth the 4 bytes, but I'd be interested to hear your take on this.
Will be fixed in the next version. Although this does bring up some deeper questions about the way we are doing hooks. I am going to revisit the hooking system soon and see if there is any room for optimization.
Currently the default inline hook shim process seems to be:
1) Original instruction 2) move LR into R0 3) store LR and r3-31 to a stack frame as usual 4) jump 5) steps 2 & 3 in reverse.
However, this pattern means that if we hook an instruction (or series of instructions) that is using r0, we won't save that value. I think ideally we would also put the original r0 value into the stack frame that we are generating. I think the added safety is likely worth the 4 bytes, but I'd be interested to hear your take on this.