Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/isa/riscv64/instr/fp.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,19 @@ void fp_update_rm_cache(uint32_t rm) {
}

bool fp_enable() {
return MUXDEF(CONFIG_MODE_USER, true, mstatus->fs != 0);
#ifdef CONFIG_MODE_USER
return true;
#else // !CONFIG_MODE_USER
if (mstatus->fs == 0) {
return false;
}
#ifdef CONFIG_RVH
if (cpu.v && vsstatus->fs == 0) {
return false;
}
#endif // CONFIG_RVH
return true;
#endif // CONFIG_MODE_USER
}

void fp_set_dirty() {
Expand Down
1 change: 1 addition & 0 deletions src/isa/riscv64/instr/rvc/decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ def_THelper(c_ldst) {

def_THelper(c_fldst) {
#ifndef CONFIG_FPU_NONE
if (!fp_enable()) return table_rt_inv(s);
int mmu_mode = isa_mmu_state();
if (mmu_mode == MMU_DIRECT) {
def_INSTR_TAB("001 ??? ??? ?? ??? ??", fld);
Expand Down
13 changes: 12 additions & 1 deletion src/isa/riscv64/instr/vp.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,19 @@
#include <cpu/cpu.h>

bool vp_enable() {
#ifdef CONFIG_MODE_USER
return true;
//return MUXDEF(CONFIG_MODE_USER, true, mstatus->vs != 0);
#else // !CONFIG_MODE_USER
if (mstatus->vs == 0) {
return false;
}
#ifdef CONFIG_RVH
if (cpu.v && vsstatus->vs == 0) {
return false;
}
#endif // CONFIG_RVH
return true;
#endif // CONFIG_MODE_USER
}

void vp_set_dirty() {
Expand Down