Open Arun-42 opened 2 years ago
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:
--------------------
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:
When this is done, add the CMake config to handle the architecture here: https://github.com/Snaipe/Mimick/blob/master/CMakeLists.txt#L50
Thanks for Snaipe's guide, I have ported Mimick to RISCV64. https://github.com/Snaipe/Mimick/pull/34
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.