Skip to content
This repository has been archived by the owner on Apr 13, 2019. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
target/riscv: Enforce MSTATUS_FS via TB flags
Check for FPU enabled at translation time.

Signed-off-by: Richard Henderson <rth@twiddle.net>
  • Loading branch information
rth7680 committed Jan 26, 2018
1 parent 993d4ed commit 1b06315
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 251 deletions.
9 changes: 8 additions & 1 deletion target/riscv/cpu.h
Expand Up @@ -231,12 +231,19 @@ void QEMU_NORETURN do_raise_exception_err(CPURISCVState *env,
uint64_t cpu_riscv_read_instret(CPURISCVState *env);
uint64_t cpu_riscv_read_rtc(void);

#define TB_FLAGS_MMU_MASK 3
#define TB_FLAGS_FP_ENABLE MSTATUS_FS

static inline void cpu_get_tb_cpu_state(CPURISCVState *env, target_ulong *pc,
target_ulong *cs_base, uint32_t *flags)
{
*pc = env->pc;
*cs_base = 0;
*flags = cpu_mmu_index(env, false);
#ifdef CONFIG_USER_ONLY
*flags = TB_FLAGS_FP_ENABLE;
#else
*flags = cpu_mmu_index(env, 0) | (env->mstatus & MSTATUS_FS);
#endif
}

static inline int riscv_mstatus_fs(CPURISCVState *env)
Expand Down

0 comments on commit 1b06315

Please sign in to comment.