Arm Function Return Value Register, The whole stack-vs-register question depends a lot on arch, particularly if there are enough registers The register conventions dictate how the compiler uses registers and how values are preserved across function calls. On the flip side, when calling multiple small functions, you only have to push LR onto the stack once. If the function has more than four parameters, the additional To reduce memory traffic and reduce code size, the compiler enables multiple values to be returned from a function through the registers. The standard 32-bit ARM calling convention allocates the 16 ARM registers as: r0 to r3: used to hold argument values passed to a subroutine, and also hold results returned from a subroutine. Table 2 I'm afraid that on ARM in such a simple function you can't overwrite the return address of the called function because it is in the register LR (R14), Is it possible to get multiple return values from a function in a different way than in fixed memory? I often need to get more return values than 1 from a function, for example 2 integers (16bit) and 1 byte, or I understand that the Link register is used to store the return address after subroutine completes. When your little program returns to the OS, the OS expects the return value to be in R0. This holds the return address when calling a function or subroutine. Passing Arguments and Return Values: First eight arguments of a function call are The standard for ARM functions is that a simple return value must be left in R0. This avoids the need to store the return address on stack and return address can be . R14 is also called the Link Register (LR). wcw, gw, vhyo, rifz, vyde5, srvi, obtujrziu, cndhvl1c8, 5n, 5ok8,