@Exzap agreed upon me reviving his #325 PR with the suggested changes.
To rephrase his PR a bit, this is meant to address two problems that prevents RPLs from being usable:
LR isn't correctly restored in __rpl_start leading to an endless loop or crash. This PR adds the assembly that was missing.
The current behavior is that RPLs use wutmalloc, which assumes that MEMGetSizeForMBlockExpHeap can be used to determine the size when reallocating memory. This adds a separate wutmalloc implementation that only RPLs will use, which co-allocates a header alongside memory so that RPLs can now reallocate memory.
I've tested the changes with RPX files that both use the custom heap and override preinit_user to use the wutmalloc implementation. This PR allows Aroma plugins/modules to continue to have access to the regular malloc implementation, while RPLs are now fully functional. After that, follow up PRs can be made to address some of the minor issues that are left to complete the RPL support in wut.
@Exzap agreed upon me reviving his #325 PR with the suggested changes.
To rephrase his PR a bit, this is meant to address two problems that prevents RPLs from being usable:
I've tested the changes with RPX files that both use the custom heap and override preinit_user to use the wutmalloc implementation. This PR allows Aroma plugins/modules to continue to have access to the regular malloc implementation, while RPLs are now fully functional. After that, follow up PRs can be made to address some of the minor issues that are left to complete the RPL support in wut.