Does a5 / x15 keep its old argument value after a call?
Do not assume so. The standard psABI marks a0-a7 as not preserved across calls.
One of the a0-a7 integer argument registers in the standard psABI. It is not preserved across calls.
The standard psABI uses a0-a7 as argument registers, with only a0-a1 also used for return values. They are not preserved across calls.
a5 / x15 belongs to the a0-a7 argument-register group. The psABI uses a0-a7 for arguments and a0-a1 for return values; these registers are not preserved across calls.
The psABI marks a0-a7 as not preserved across calls.
After a call returns, do not assume the old a5 argument value still exists.
For a scalar of at most XLEN bits, the psABI passes it by value on the stack when no argument register is available.
addi a5, zero, 3 # write a5
# a5 is an argument register, outside the a0-a1 return-value registersDo not assume so. The standard psABI marks a0-a7 as not preserved across calls.
The psABI uses a0-a1 for return values as well as arguments.