]> www.infradead.org Git - users/dwmw2/qemu.git/commit
target/riscv: Update $ra with current $pc in trans_cm_jalt()
authorJason Chien <jason.chien@sifive.com>
Wed, 7 Feb 2024 08:18:08 +0000 (16:18 +0800)
committerAlistair Francis <alistair.francis@wdc.com>
Fri, 8 Mar 2024 05:37:20 +0000 (15:37 +1000)
commit3011c1dd9c807cf41997d13c9244ea4e92237575
tree4b812efae1cd41e15b19eaab87fb9efb75af6dc6
parent8f6330a807f2642dc2a3cdf33347aa28a4c00a87
target/riscv: Update $ra with current $pc in trans_cm_jalt()

The original implementation sets $pc to the address read from the jump
vector table first and links $ra with the address of the next instruction
after the updated $pc. After jumping to the updated $pc and executing the
next ret instruction, the program jumps to $ra, which is in the same
function currently executing, which results in an infinite loop.
This commit stores the jump address in a temporary, updates $ra with the
current $pc, and copies the temporary to $pc.

Signed-off-by: Jason Chien <jason.chien@sifive.com>
Reviewed-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20240207081820.28559-1-jason.chien@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
target/riscv/insn_trans/trans_rvzce.c.inc