Ruinland ChuanTzu Tsai <ruinland@andestech.com> writes:
On Thu, Oct 21, 2021 at 12:17:47PM -0700, Richard Henderson wrote:
On 10/21/21 8:11 AM, Ruinland Chuan-Tzu Tsai wrote:
In this patch, we demonstrate how Andes Performance Extension(c) insn :
bfos and bfoz could be used with Andes CoDense : exec.it.
<snip>
+static int andes_v5_gen_codense_exec_it(CPURISCVState *env, DisasContext *ctx,
arg_execit *a)
+{
+ uint32_t insn;
+ uint32_t imm_ex10 = a->imm_codense;
+ target_ulong uitb_val = 0;
+ riscv_csrrw(env, 0x800, &uitb_val, 0, 0);
This won't work -- you can't access env during translation. So all this
faff around passing env through HartState is for naught.
Sorry, please elaborate me a little bit more.
When dealing with translation you need to separate the translation phase
from the execution phase. CPUEnv is the current run time state of the
vCPU so the value that might be stored in it when you do translation
could very well be different when the translation runs (or runs again).
The correct way to deal with this is by the use of translation flags...