riscv: Avoid clobbering register parameters in syscall
commitbe74b42ee2a97009a6cd4fc90126add4a41c583b
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 10 Feb 2020 13:32:14 +0000 (10 10:32 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Sat, 15 Feb 2020 00:09:12 +0000 (14 21:09 -0300)
treeabd877a414bb54d794737f7a55bd8270b07ee83b
parent6cc8fc7c1506e8084d65b078ff5b05a92e17a28a
riscv: Avoid clobbering register parameters in syscall

The riscv INTERNAL_SYSCALL macro might clobber the register
parameter if the argument itself might clobber any register (a function
call for instance).

This patch fixes it by using temporary variables for the expressions
between the register assignments (as indicated by GCC documentation,
6.47.5.2 Specifying Registers for Local Variables).

It is similar to the fix done for MIPS (bug 25523).

Checked with riscv64-linux-gnu-rv64imafdc-lp64d build.
sysdeps/unix/sysv/linux/riscv/sysdep.h