To enforce misa.E, target/riscv/translate.c needs register bounds checks added for the Base ISA ('I'/'E') and to generate illegal instruction exceptions if 'E' is set in misa and regno >= 16.
All other extensions are already disallowed on 'E' processors. 'M', 'A', 'F', 'D' and 'C' will already generate illegal instruction exceptions if not present so we only need to add register bounds checks to the Base ISA ('I'/'E') opcodes.
After adding enforcement to translate.c we need to alter write_misa to allow setting the 'E' flag:
To enforce
misa.E
,target/riscv/translate.c
needs register bounds checks added for the Base ISA ('I'/'E') and to generate illegal instruction exceptions if 'E' is set inmisa
and regno >= 16.All other extensions are already disallowed on 'E' processors. 'M', 'A', 'F', 'D' and 'C' will already generate illegal instruction exceptions if not present so we only need to add register bounds checks to the Base ISA ('I'/'E') opcodes.
After adding enforcement to
translate.c
we need to alterwrite_misa
to allow setting the 'E' flag: