I am working with ARM assembly, where I have to write one subroutine for which I am following the ARM calling convention(this will have to be integrated with some separate higher level implementation somewhere else ) for passing parameters and return values.
Now here is something I am not sure in general when working with assembly.
So from the convention if I understand well the arguments are passed in order starting from registers r0 - r4 and then for other arguments stacks are used. Return values are passed to r0.
Now here is what I am confused with. If I am supposed to save the context of r0 and pop it off after then there is no way to return the result, the only way it can be done is by corrupting the first argument.
Is there a workaround somehow?