Skip to content

Commit cb4f3b1

Browse files
committed
Fixed floating-point register handling on ARM64
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.
1 parent 89c7e02 commit cb4f3b1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Sources/SuperBuilder/src/ITKSuperBuilder.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,10 @@ asm volatile (
200200

201201
#if PROTECT_FLOATING_POINT_REGISTERS
202202
// pop {q0-q7}
203-
"ldp q6, q7, [sp], #32\n"
204-
"ldp q4, q5, [sp], #32\n"
205-
"ldp q2, q3, [sp], #32\n"
206203
"ldp q0, q1, [sp], #32\n"
204+
"ldp q2, q3, [sp], #32\n"
205+
"ldp q4, q5, [sp], #32\n"
206+
"ldp q6, q7, [sp], #32\n"
207207
#endif
208208

209209
// get new return (adr of the objc_super class)

0 commit comments

Comments
 (0)