RISC-V: preserve a1 in mcount
authorJamie Iles <jamie@jamieiles.com>
Tue, 15 Nov 2022 20:08:31 +0000 (20:08 +0000)
committerPalmer Dabbelt <palmer@rivosinc.com>
Fri, 2 Dec 2022 18:04:37 +0000 (10:04 -0800)
commitdc58a24db8c12ea361e94eaf53adc5d471534694
tree33800d8989bbdd0b2284a87b175eeed701e7ef21
parent3bd7743f8d6d7171db9897a746038eefd52a1fbd
RISC-V: preserve a1 in mcount

The RISC-V ELF psABI states that both a0 and a1 are used for return
values so we should preserve them both in return_to_handler.  This is
especially important for RV32 for functions returning a 64-bit quantity
otherwise the return value can be corrupted and undefined behaviour
results.

Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Jamie Iles <jamie@jamieiles.com>
Link: https://lore.kernel.org/r/20221115200832.706370-4-jamie@jamieiles.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/kernel/mcount.S