Re: [PATCH v2 1/3] target/riscv: Fix tb->flags FS status

2020-01-14 Thread ShihPo Hung
On Tue, Jan 14, 2020 at 11:29 PM Richard Henderson < richard.hender...@linaro.org> wrote: > On 1/14/20 12:13 AM, shihpo.h...@sifive.com wrote: > > if (riscv_cpu_fp_enabled(env)) { > > -*flags |= TB_FLAGS_MSTATUS_FS; > > +*flags |= env->mstatus & MSTATUS_FS; > > } > > Note

Re: [PATCH v2 1/3] target/riscv: Fix tb->flags FS status

2020-01-14 Thread Richard Henderson
On 1/14/20 12:13 AM, shihpo.h...@sifive.com wrote: > if (riscv_cpu_fp_enabled(env)) { > -*flags |= TB_FLAGS_MSTATUS_FS; > +*flags |= env->mstatus & MSTATUS_FS; > } Note that riscv_cpu_fp_enabled is *also* testing env->mstatus, and that this assignment can be made uncondit

[PATCH v2 1/3] target/riscv: Fix tb->flags FS status

2020-01-14 Thread shihpo . hung
It was found that running libquantum on riscv-linux qemu produced an incorrect result. After investigation, FP registers are not saved during context switch due to incorrect mstatus.FS. In current implementation tb->flags merges all non-disabled state to dirty. This means the code in mark_fs_dirty