Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r0 gets clobbered on InlineHook #2

Open
WispSSBM opened this issue Jul 14, 2024 · 1 comment
Open

r0 gets clobbered on InlineHook #2

WispSSBM opened this issue Jul 14, 2024 · 1 comment

Comments

@WispSSBM
Copy link

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.

@Sammi-Husky
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants