mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 16:53:55 -06:00
target/riscv: rvv-1.0: add mstatus VS field
Signed-off-by: LIU Zhiwei <zhiwei_liu@c-sky.com> Signed-off-by: Frank Chang <frank.chang@sifive.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20211210075704.23951-4-frank.chang@sifive.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
52561f2a80
commit
61b4b69d12
4 changed files with 33 additions and 2 deletions
|
@ -90,12 +90,17 @@ void cpu_get_tb_cpu_state(CPURISCVState *env, target_ulong *pc,
|
|||
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
flags |= TB_FLAGS_MSTATUS_FS;
|
||||
flags |= TB_FLAGS_MSTATUS_VS;
|
||||
#else
|
||||
flags |= cpu_mmu_index(env, 0);
|
||||
if (riscv_cpu_fp_enabled(env)) {
|
||||
flags |= env->mstatus & MSTATUS_FS;
|
||||
}
|
||||
|
||||
if (riscv_cpu_vector_enabled(env)) {
|
||||
flags |= env->mstatus & MSTATUS_VS;
|
||||
}
|
||||
|
||||
if (riscv_has_ext(env, RVH)) {
|
||||
if (env->priv == PRV_M ||
|
||||
(env->priv == PRV_S && !riscv_cpu_virt_enabled(env)) ||
|
||||
|
@ -189,11 +194,24 @@ bool riscv_cpu_fp_enabled(CPURISCVState *env)
|
|||
return false;
|
||||
}
|
||||
|
||||
/* Return true is vector support is currently enabled */
|
||||
bool riscv_cpu_vector_enabled(CPURISCVState *env)
|
||||
{
|
||||
if (env->mstatus & MSTATUS_VS) {
|
||||
if (riscv_cpu_virt_enabled(env) && !(env->mstatus_hs & MSTATUS_VS)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void riscv_cpu_swap_hypervisor_regs(CPURISCVState *env)
|
||||
{
|
||||
uint64_t mstatus_mask = MSTATUS_MXR | MSTATUS_SUM | MSTATUS_FS |
|
||||
MSTATUS_SPP | MSTATUS_SPIE | MSTATUS_SIE |
|
||||
MSTATUS64_UXL;
|
||||
MSTATUS64_UXL | MSTATUS_VS;
|
||||
bool current_virt = riscv_cpu_virt_enabled(env);
|
||||
|
||||
g_assert(riscv_has_ext(env, RVH));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue