• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisionb655dc7cd91588a77c3df6f618246fd88ad14249 (tree)
Time2022-01-21 14:52:57
AuthorLIU Zhiwei <zhiwei_liu@c-sk...>
CommiterAlistair Francis

Log Message

target/riscv: Don't save pc when exception return

As pc will be written by the xepc in exception return, just ignore
pc in translation.

Signed-off-by: LIU Zhiwei <zhiwei_liu@c-sky.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20220120122050.41546-3-zhiwei_liu@c-sky.com
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

Change Summary

Incremental Difference

--- a/target/riscv/helper.h
+++ b/target/riscv/helper.h
@@ -100,8 +100,8 @@ DEF_HELPER_2(csrr_i128, tl, env, int)
100100 DEF_HELPER_4(csrw_i128, void, env, int, tl, tl)
101101 DEF_HELPER_6(csrrw_i128, tl, env, int, tl, tl, tl, tl)
102102 #ifndef CONFIG_USER_ONLY
103-DEF_HELPER_2(sret, tl, env, tl)
104-DEF_HELPER_2(mret, tl, env, tl)
103+DEF_HELPER_1(sret, tl, env)
104+DEF_HELPER_1(mret, tl, env)
105105 DEF_HELPER_1(wfi, void, env)
106106 DEF_HELPER_1(tlb_flush, void, env)
107107 #endif
--- a/target/riscv/insn_trans/trans_privileged.c.inc
+++ b/target/riscv/insn_trans/trans_privileged.c.inc
@@ -74,10 +74,8 @@ static bool trans_uret(DisasContext *ctx, arg_uret *a)
7474 static bool trans_sret(DisasContext *ctx, arg_sret *a)
7575 {
7676 #ifndef CONFIG_USER_ONLY
77- tcg_gen_movi_tl(cpu_pc, ctx->base.pc_next);
78-
7977 if (has_ext(ctx, RVS)) {
80- gen_helper_sret(cpu_pc, cpu_env, cpu_pc);
78+ gen_helper_sret(cpu_pc, cpu_env);
8179 tcg_gen_exit_tb(NULL, 0); /* no chaining */
8280 ctx->base.is_jmp = DISAS_NORETURN;
8381 } else {
@@ -92,8 +90,7 @@ static bool trans_sret(DisasContext *ctx, arg_sret *a)
9290 static bool trans_mret(DisasContext *ctx, arg_mret *a)
9391 {
9492 #ifndef CONFIG_USER_ONLY
95- tcg_gen_movi_tl(cpu_pc, ctx->base.pc_next);
96- gen_helper_mret(cpu_pc, cpu_env, cpu_pc);
93+ gen_helper_mret(cpu_pc, cpu_env);
9794 tcg_gen_exit_tb(NULL, 0); /* no chaining */
9895 ctx->base.is_jmp = DISAS_NORETURN;
9996 return true;
--- a/target/riscv/op_helper.c
+++ b/target/riscv/op_helper.c
@@ -115,7 +115,7 @@ target_ulong helper_csrrw_i128(CPURISCVState *env, int csr,
115115
116116 #ifndef CONFIG_USER_ONLY
117117
118-target_ulong helper_sret(CPURISCVState *env, target_ulong cpu_pc_deb)
118+target_ulong helper_sret(CPURISCVState *env)
119119 {
120120 uint64_t mstatus;
121121 target_ulong prev_priv, prev_virt;
@@ -176,7 +176,7 @@ target_ulong helper_sret(CPURISCVState *env, target_ulong cpu_pc_deb)
176176 return retpc;
177177 }
178178
179-target_ulong helper_mret(CPURISCVState *env, target_ulong cpu_pc_deb)
179+target_ulong helper_mret(CPURISCVState *env)
180180 {
181181 if (!(env->priv >= PRV_M)) {
182182 riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, GETPC());