Skip to content

Commit 64d27a5

Browse files
committed
Fix envcfg check when S/H-mode is not available
1 parent 58da6a2 commit 64d27a5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

riscv/decode_macros.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ static inline bool is_aligned(const unsigned val, const unsigned pos)
193193
#define require_envcfg(field) \
194194
do { \
195195
if (((STATE.prv != PRV_M) && (m##field == 0)) || \
196-
((STATE.prv == PRV_U && !STATE.v) && (s##field == 0))) \
196+
(p->extension_enabled('S') && (STATE.prv == PRV_U && !STATE.v) && (s##field == 0))) \
197197
throw trap_illegal_instruction(insn.bits()); \
198-
else if (STATE.v && ((h##field == 0) || \
199-
((STATE.prv == PRV_U) && (s##field == 0)))) \
198+
else if (p->extension_enabled('H') && STATE.v && ((h##field == 0) || \
199+
(p->extension_enabled('S') && (STATE.prv == PRV_U) && (s##field == 0)))) \
200200
throw trap_virtual_instruction(insn.bits()); \
201201
} while (0);
202202

0 commit comments

Comments
 (0)