All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] target/riscv: Fix sstatus update in rv128
@ 2026-07-29  8:39 frederic.petrot
  2026-07-29  8:39 ` [PATCH 2/2] target/riscv: Allow UXL to be 3 in mstatus on rv128 frederic.petrot
  2026-08-07  9:23 ` [PATCH 1/2] target/riscv: Fix sstatus update in rv128 Daniel Henrique Barboza
  0 siblings, 2 replies; 4+ messages in thread
From: frederic.petrot @ 2026-07-29  8:39 UTC (permalink / raw)
  To: daniel.barboza, palmer, alistair.francis, liwei1518, zhiwei_liu,
	chao.liu, qemu-riscv, qemu-devel
  Cc: Frédéric Pétrot

From: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>

The sstatus register assignment was performed before the write
mask was fully constructed, leading to an incomplete update of
sstatus fields on the experimental rv128 target.

Move the sstatus write after the mask completion so the full
write mask is applied correctly.

Signed-off-by: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>
---
 target/riscv/tcg/csr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/riscv/tcg/csr.c b/target/riscv/tcg/csr.c
index 36f2004bc5..d834b77714 100644
--- a/target/riscv/tcg/csr.c
+++ b/target/riscv/tcg/csr.c
@@ -3984,7 +3984,7 @@ static RISCVException read_sstatus_i128(CPURISCVState *env, int csrno,
                                         Int128 *val)
 {
     uint64_t mask = sstatus_v1_10_mask;
-    uint64_t sstatus = env->mstatus & mask;
+    uint64_t sstatus;
     if (env->xl != MXL_RV32 || env->debugger) {
         mask |= SSTATUS64_UXL;
     }
@@ -3995,7 +3995,7 @@ static RISCVException read_sstatus_i128(CPURISCVState *env, int csrno,
     if (env_archcpu(env)->cfg.ext_zicfilp) {
         mask |= SSTATUS_SPELP;
     }
-
+    sstatus = env->mstatus & mask;
     *val = int128_make128(sstatus, add_status_sd(MXL_RV128, sstatus));
     return RISCV_EXCP_NONE;
 }
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-07  9:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-29  8:39 [PATCH 1/2] target/riscv: Fix sstatus update in rv128 frederic.petrot
2026-07-29  8:39 ` [PATCH 2/2] target/riscv: Allow UXL to be 3 in mstatus on rv128 frederic.petrot
2026-08-07  9:23   ` Daniel Henrique Barboza
2026-08-07  9:23 ` [PATCH 1/2] target/riscv: Fix sstatus update in rv128 Daniel Henrique Barboza

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.