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
I am trying to cross-compile ROS2 to RISCV64, and Mimick is a dependency. Could you please add support for RISCV64? Or if you could provide pointers as how to do it, I could work on it.
The trampoline must be written with position-independent instructions, as it gets copied to multiple locations. It also must not clobber any of the ABI registers and stack, as its main role is to prepare some state before long-jumping to the stub function. This is why you'll see most trampolines backing up the state of some registers before restoring said state later on.
The general memory layout of a trampoline is as follows:
--------------------
struct mmk_stub * context pointer of stub (8 bytes)
--------------------
plt_fn * function pointer of stub (8 bytes)
--------------------
mmk_trampoline trampoline opcodes (N bytes)
...
mmk_trampoline_end
--------------------
You can get inspiration from other architectures, but the general gist is that the higher-level behavior of the trampoline is:
Load mmk_stub pointer
Call mmk_stub->ctx_set
Call mmk_stub->ctx_asked
If ctx_asked returned 0, this is a stub trampoline jump, perform a long jump to the stub function pointer
Otherwise, this is mimick trying to retrieve the trampoline context, call mmk_stub->ctx_get and return its result.
Activity
Snaipe commentedon Nov 4, 2022
You would need to add a new trampoline for the architecture here: https://github.com/Snaipe/Mimick/tree/master/src/asm
The trampoline must be written with position-independent instructions, as it gets copied to multiple locations. It also must not clobber any of the ABI registers and stack, as its main role is to prepare some state before long-jumping to the stub function. This is why you'll see most trampolines backing up the state of some registers before restoring said state later on.
The general memory layout of a trampoline is as follows:
You can get inspiration from other architectures, but the general gist is that the higher-level behavior of the trampoline is:
When this is done, add the CMake config to handle the architecture here: https://github.com/Snaipe/Mimick/blob/master/CMakeLists.txt#L50
ziyao233 commentedon Mar 26, 2023
Thanks for Snaipe's guide, I have ported Mimick to RISCV64.
#34