This repository was archived by the owner on Dec 27, 2025. It is now read-only.
restore floating point registers from stack in reverse order#37
Open
ishutinvv wants to merge 2 commits intosteipete:masterfrom
Open
restore floating point registers from stack in reverse order#37ishutinvv wants to merge 2 commits intosteipete:masterfrom
ishutinvv wants to merge 2 commits intosteipete:masterfrom
Conversation
lukaskubanek
added a commit
to structuredpath/InterposeKit
that referenced
this pull request
Oct 21, 2024
This commit applies the patch from steipete/InterposeKit#37, which resolves an issue affecting swizzled methods that take `CGFloat` parameters or structs containing `CGFloat` (such as `CGPoint` or `CGRect`) on ARM64. The issue occurred because floating-point registers were apparently not being restored in the correct order, causing values in those registers to become shuffled after the trampoline call. The fix ensures that floating-point registers are restored in reverse order, as required by ARM64 calling conventions. According to the referenced PR, regular registers were already handled correctly, so this issue specifically affected floating-point parameters.
lukaskubanek
added a commit
to structuredpath/InterposeKit
that referenced
this pull request
Mar 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We should restore registers preserved in stack in reverse order. Otherwise, it leads to shuffled values in those registers after trampoline.
The simplest way to reproduce is to swizzle any method from UIKit that accepts CGFloat or plain struct like CGRect. It's relevant only to arm64.
Btw, regular registers get restored correctly.