|
From: | Richard Henderson |
Subject: | Re: [PATCH v4 1/2] target/riscv: separate priv from mmu_idx |
Date: | Thu, 23 Mar 2023 09:07:10 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 |
On 3/22/23 23:00, Wu, Fei wrote:
+ ctx->priv = env->priv;This is not right. You should put env->priv into tb flags before you use it in translation.I see some other env usages in this function, when will env->priv and tb_flags.priv mismatch (assume we have recorded priv in tb_flags)?
You are correct that they should match, because of tb_flags, but it is bad form to read from env, as that leads to errors. Since you *can* read the same data from tb_flags, you should.
The read of misa_ext and misa_mxl_max are correct, because they are constant set at cpu init/realize.
The read of vstart is incorrect. The TB_FLAGS field is VL_EQ_VLMAX, which includes a test for vstart == 0, but the smaller vstart == 0 test is not extractable from that. Thus the usage in e.g. vext_check_reduction is incorrect. One would require a new TB_FLAGS bit to encode vstart ==/!= 0 alone.
r~
[Prev in Thread] | Current Thread | [Next in Thread] |