[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6 4/6] target/riscv: Add support for PC-relative translation
From: |
liweiwei |
Subject: |
Re: [PATCH v6 4/6] target/riscv: Add support for PC-relative translation |
Date: |
Tue, 4 Apr 2023 23:39:03 +0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 |
On 2023/4/4 23:27, Richard Henderson wrote:
On 4/4/23 08:14, liweiwei wrote:
On 2023/4/4 22:57, Richard Henderson wrote:
On 4/4/23 07:33, liweiwei wrote:
If we want to hide all of them in gen_pc_plus_diff, then we need
calculate the diff for pc_succ_insn or introduce a new API for it,
since we need get the successor pc in many instructions.
And the logic for gen_goto_tb or gen_set_pc_imm also need update.
Yes, exactly.
Sorry, I didn't find benefits from this. If we do this, we'll firstly
calculate the diff = pc_succ_insn - pc_next, then we add it with
pc_next - pc_save to get the relative address to env->pc.
It will me simpler because you'll move all of the calculations into a
helper function.
helper? Do you mean gen_pc_plus_diff?
The trans_* functions will be supplying a immediate directly:
* for auipc, this is a->imm,
Yeah. this will be simpler in trans_, however the total calculation is
the same. we just move a->imm + pc_next to gen_pc_plus_diff.
* for jalr, this is 0.
Not 0, but pc_succ_insn - pc_next. This may be the case in many place.
Regards,
Weiwei Li
r~
Re: [PATCH v6 4/6] target/riscv: Add support for PC-relative translation, Richard Henderson, 2023/04/04