[PATCH 1/5] include: Add mstatus[h].GVA encodings
Andrew Jones
ajones at ventanamicro.com
Thu Aug 4 00:50:30 PDT 2022
On Thu, Aug 04, 2022 at 11:17:02AM +0800, Vivian Wang wrote:
> The machine mode GVA field is in mstatus for RV64 and mstatush for RV32,
> and is available if the hypervisor extension is available. If an
> exception occurs, we may need to redirect the trap to HS-mode, in which
> case, hstatus.GVA should be set to same as the machine mode GVA bit.
>
> Add MSTATUS_GVA for RV64, MSTATUSH_GVA for RV32, and their SHIFT
> encodings. The SHIFT index is helpful in assembly code, since field
> extraction can be implemented in only one register. In pseudocode:
>
> - For RV32: gva = (mstatus >> MSTATUS_GVA_SHIFT) & 1;
> - For RV64: gva = (mstatush >> MSTATUSH_GVA_SHIFT) & 1;
>
> Signed-off-by: Vivian Wang <dramforever at live.com>
> ---
> include/sbi/riscv_encoding.h | 4 ++++
> 1 file changed, 4 insertions(+)
Reviewed-by: Andrew Jones <ajones at ventanamicro.com>
More information about the opensbi
mailing list