aboutsummaryrefslogtreecommitdiff
path: root/target/nios2/translate.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2022-04-21 08:17:28 -0700
committerRichard Henderson <richard.henderson@linaro.org>2022-04-26 08:17:05 -0700
commite84f1768449330a5b4c62a8aaa68f102ba6ec573 (patch)
treeaf6ca0b49c5612a35ac77da507974dba9ee71713 /target/nios2/translate.c
parenta25c4eff32ba6192cff648ccaf0316bd829c80af (diff)
target/nios2: Advance pc when raising exceptions
The exception return address for nios2 is the instruction after the one that was executing at the time of the exception. We have so far implemented this by advancing the pc during the process of raising the exception. It is perhaps a little less confusing to do this advance in the translator (and helpers) when raising the exception in the first place, so that we may more closely match kernel sources. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20220421151735.31996-58-richard.henderson@linaro.org>
Diffstat (limited to 'target/nios2/translate.c')
-rw-r--r--target/nios2/translate.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/target/nios2/translate.c b/target/nios2/translate.c
index b52f98180d..3a037a68cc 100644
--- a/target/nios2/translate.c
+++ b/target/nios2/translate.c
@@ -202,10 +202,10 @@ static TCGv dest_gpr(DisasContext *dc, unsigned reg)
#endif
}
-static void t_gen_helper_raise_exception(DisasContext *dc,
- uint32_t index)
+static void t_gen_helper_raise_exception(DisasContext *dc, uint32_t index)
{
- tcg_gen_movi_tl(cpu_pc, dc->pc);
+ /* Note that PC is advanced for all hardware exceptions. */
+ tcg_gen_movi_tl(cpu_pc, dc->base.pc_next);
gen_helper_raise_exception(cpu_env, tcg_constant_i32(index));
dc->base.is_jmp = DISAS_NORETURN;
}