You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 15, 2021. It is now read-only.
At some point, we also want to be able to call Swift functions. I guess that means for every unique function signature, we need to dynamically generate a wrapper function using the low-level Arm64Writer that puts all parameters in all the right registers according to the Swift calling convention.
Maybe we could also add a Swift calling convention to frida-gum, but I'm not sure how that would make things easier.
The text was updated successfully, but these errors were encountered:
While I've found some working workarounds for the moment, I already found two issues with the missing calling convention when implementing toString in #1:
In AARCH64, when a return value is returned in memory, the callee says where to store such a value by setting the r8 ("indirect result") register. Frida does this correctly when we tell it to call a function returning a large enough struct. But it also immediately converts the return value into the JavaScript equivalents of the defined struct. In Swift, however, we sometimes need to call e.g. destructors or move constructors before that happens. On other platforms this is no problem, because the pointer to the memory of the return value is usually just passed as the first parameter - so we could just manage the allocation ourselves and tell Frida the function has one more parameter and returns void.
For methods, Swift uses the x20 register on AARCH64 and the r10 register on ARMv7 to pass the pointer to self. (Or at least it does for the one method I've looked at for the moment.) As far as iOS's C calling convention is concerned, those are not used for parameters, so we can't set it using Frida's existing calling conventions.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
At some point, we also want to be able to call Swift functions. I guess that means for every unique function signature, we need to dynamically generate a wrapper function using the low-level
Arm64Writer
that puts all parameters in all the right registers according to the Swift calling convention.Maybe we could also add a Swift calling convention to frida-gum, but I'm not sure how that would make things easier.
The text was updated successfully, but these errors were encountered: