Content originally posted in LPCWare by starblue on Tue Mar 03 09:25:26 MST 2015
You need to write your function so that it conforms to the procedure call standard (AAPCS, ARM document IHI0042D).
For simple cases it suffices to know that the first four 32 bit arguments end up in R0 to R3, a 32 bit result is in R0. R4 to R11 need to be preserved. (No guarantees that this is correct or complete, better check for yourself.)