-
Is there any way to execute arbitrary bytecode/assembly code in Cosmos? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
If you know that the calling convention of the function you want to call is the same as IL2CPU's flavor of cdecl, then you should be able to just cast the memory address into a function pointer, and then call that. If that doesn't work (I'm not sure if IL2CPU actually supports function pointers), you can also try creating a X# plug that does a AuraOS has arbitrary binary execution, so you can take a look at how they implemented it. |
Beta Was this translation helpful? Give feedback.
If you know that the calling convention of the function you want to call is the same as IL2CPU's flavor of cdecl, then you should be able to just cast the memory address into a function pointer, and then call that.
If that doesn't work (I'm not sure if IL2CPU actually supports function pointers), you can also try creating a X# plug that does a
call
into your function of choice. This also allows you to translate between calling conventions (if it's the same as cdecl, then you can justjmp
instead).AuraOS has arbitrary binary execution, so you can take a look at how they implemented it.