Skip to content

Commit

Permalink
rv64,priv: fix the write mask of mstatus (#192)
Browse files Browse the repository at this point in the history
Bits 0 and 4 are WPRI fields.
  • Loading branch information
kong-ling-hui authored Sep 26, 2023
1 parent 7830f20 commit 55380e2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/isa/riscv64/system/priv.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ static inline word_t* csr_decode(uint32_t addr) {

// WPRI, SXL, UXL cannot be written
#ifdef CONFIG_RVH
#define MSTATUS_WMASK (0x7e79bbUL) | (1UL << 63) | (1UL << 39) | (1UL << 38)
#define MSTATUS_WMASK (0x7e79aaUL) | (1UL << 63) | (1UL << 39) | (1UL << 38)
#define HSTATUS_WMASK ((1 << 22) | (1 << 21) | (1 << 20) | (1 << 18) | (0x3f << 12) | (1 << 9) | (1 << 8) | (1 << 7) | (1 << 6) | (1 << 5))
#elif defined(CONFIG_RVV)
#define MSTATUS_WMASK (0x7e79bbUL) | (1UL << 63) | (3UL << 8)
#define MSTATUS_WMASK (0x7e79aaUL) | (1UL << 63) | (3UL << 8)
#else
#define MSTATUS_WMASK (0x7e79bbUL) | (1UL << 63)
#define MSTATUS_WMASK (0x7e79aaUL) | (1UL << 63)
#endif

#ifdef CONFIG_RVH
Expand Down

0 comments on commit 55380e2

Please sign in to comment.