|
|
b98348 |
From 82f014671cf057de51c4a577c9e2ad637dcec6f9 Mon Sep 17 00:00:00 2001
|
|
|
b98348 |
From: ShihPo Hung <shihpo.hung@sifive.com>
|
|
|
b98348 |
Date: Tue, 14 Jan 2020 22:17:33 -0800
|
|
|
b98348 |
Subject: [PATCH 5/5] target/riscv: update mstatus.SD when FS is set dirty
|
|
|
b98348 |
|
|
|
b98348 |
remove the check becuase SD bit should summarize FS and XS fields
|
|
|
b98348 |
unconditionally.
|
|
|
b98348 |
|
|
|
b98348 |
Signed-off-by: ShihPo Hung <shihpo.hung@sifive.com>
|
|
|
b98348 |
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
|
|
|
b98348 |
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
|
|
|
b98348 |
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
|
|
|
b98348 |
---
|
|
|
b98348 |
target/riscv/csr.c | 3 +--
|
|
|
b98348 |
target/riscv/translate.c | 2 +-
|
|
|
b98348 |
2 files changed, 2 insertions(+), 3 deletions(-)
|
|
|
b98348 |
|
|
|
b98348 |
diff --git a/target/riscv/csr.c b/target/riscv/csr.c
|
|
|
b98348 |
index da02f9f0b1..0e34c292c5 100644
|
|
|
b98348 |
--- a/target/riscv/csr.c
|
|
|
b98348 |
+++ b/target/riscv/csr.c
|
|
|
b98348 |
@@ -341,8 +341,7 @@ static int write_mstatus(CPURISCVState *env, int csrno, target_ulong val)
|
|
|
b98348 |
|
|
|
b98348 |
mstatus = (mstatus & ~mask) | (val & mask);
|
|
|
b98348 |
|
|
|
b98348 |
- dirty = (riscv_cpu_fp_enabled(env) &&
|
|
|
b98348 |
- ((mstatus & MSTATUS_FS) == MSTATUS_FS)) |
|
|
|
b98348 |
+ dirty = ((mstatus & MSTATUS_FS) == MSTATUS_FS) |
|
|
|
b98348 |
((mstatus & MSTATUS_XS) == MSTATUS_XS);
|
|
|
b98348 |
mstatus = set_field(mstatus, MSTATUS_SD, dirty);
|
|
|
b98348 |
env->mstatus = mstatus;
|
|
|
b98348 |
diff --git a/target/riscv/translate.c b/target/riscv/translate.c
|
|
|
b98348 |
index ab6a891dc3..8e40ed3ac4 100644
|
|
|
b98348 |
--- a/target/riscv/translate.c
|
|
|
b98348 |
+++ b/target/riscv/translate.c
|
|
|
b98348 |
@@ -394,7 +394,7 @@ static void mark_fs_dirty(DisasContext *ctx)
|
|
|
b98348 |
|
|
|
b98348 |
tmp = tcg_temp_new();
|
|
|
b98348 |
tcg_gen_ld_tl(tmp, cpu_env, offsetof(CPURISCVState, mstatus));
|
|
|
b98348 |
- tcg_gen_ori_tl(tmp, tmp, MSTATUS_FS);
|
|
|
b98348 |
+ tcg_gen_ori_tl(tmp, tmp, MSTATUS_FS | MSTATUS_SD);
|
|
|
b98348 |
tcg_gen_st_tl(tmp, cpu_env, offsetof(CPURISCVState, mstatus));
|
|
|
b98348 |
tcg_temp_free(tmp);
|
|
|
b98348 |
}
|
|
|
b98348 |
--
|
|
|
b98348 |
2.24.1
|
|
|
b98348 |
|