On 4/2/23 06:17, LIU Zhiwei wrote:
Why set pc_save here? IMHO, pc_save is a constant.
pc_save is a value which is strictly related to the value of env->pc.
real_pc = (old)env->pc + target_pc(from tb) - ctx->pc_save
In this formula, the meaning of target_pc(from tb) doesn't match with gen_get_target_pc in
the code. Its meaning in the code matches the real_pc in the formula. I think we should
rename the gen_get_target_pc to gen_get_real_pc.
Neither name is ideal, because it is also used for things that are not "pc".
See e.g. target/arm/, where this is called gen_pc_plus_diff.
This makes slightly more sense for uses like auipc and jalr.
r~