-
Notifications
You must be signed in to change notification settings - Fork 54
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
Is it possible to skip the original instruction in midhook? #38
Comments
This is a similar request to #37 but slightly different. I'm more concerned that mid hook doesn't provide access to XMM registers. It's something I've been meaning to address. As for your specific request, why couldn't you just midhook the next instruction and make the modifications there? This would keep midhook simple, once I make it capture XMM registers. |
Thanks for the response. The problem I am trying to solve is that for example,
would compute 1/x for the 4 packed floats. However, this instruction would result in different results on Intel and AMD, so I need to replace it with for example divps which would produce the same result. The problem is after the instruction, the original values (in XMM0) is already replaced with the results, so they are no longer available. So the most robust way is to replace the original instruction (without executing it). The plan is to use things like asmjit to generate the required instructions as the hook function. |
I've created a PR #39 that allows you to change the instruction pointer, effectively letting you bypass the trampoline that would execute the original instruction. I think a lot of care will need to be taken to use this safely, but the option is there now. I will also be adding XMM register capture to this PR before merging it into main. |
I've added XMM capture as well to that PR. Let me know if those changes are enough for you to do what you want. |
Thank you, I think it is working in my test |
Thanks for the great library. Now I am trying to implement a midhook that need to replace the original instruction. The original instruction is something like
and I need to replace it with exact computation so that the result will be consistent on both Intel and AMD.
Is it possible? Maybe related to #37?
The text was updated successfully, but these errors were encountered: