.syntax unified .thumb .fpu fpv4-sp-d16 .cpu cortex-m4 @ Here’s an EABI-compliant FFI stub we can call from C in @ dumbjit.c. Its first argument is the address of the @ JIT-compiled subroutine to call. Up to three other @ arguments are passed on the operand stack to that @ subroutine; one value is returned. Note that the arguments @ are pushed on the stack backwards: the first argument is @ passed on top of the stack, the second argument under that, @ and the third under that. .globl jit_eabi_stub .thumb_func jit_eabi_stub: push {r4, r5, r6, lr} @ The JIT-compiled code uses r4 and r5; the ldr r4, =operand_stack @ EABI requires preserving them. mov r5, r1 @ Pass second EABI argument on top of stack. stmia r4!, {r3} stmia r4!, {r2} blx r0 mov r0, r5 @ take EABI return value from top of stack pop {r4, r5, r6, pc} .bss operand_stack: .fill 1024