[libre-riscv-dev] system call (sc) LEV "reserved field"

Luke Kenneth Casson Leighton lkcl at lkcl.net
Wed Jul 22 15:22:43 BST 2020

hi, we're just reviewing the behaviour needed when LEV != 0, and are
following what microwatt does (which does not have hypervisor support


so the trail - i am so glad that the PDF has cross-reference linking -
jumps from one section to another and after jumping 5 times we
eventually ascertain the hypothesis that reserved fields, if set,
should raise an "illegal instruction".

however this is so unclear (because of the referral from one section
to another) that i am seeking confirmation.  should we raise an
"illegal instruction" when "LEV > 1" on sc?

secondly, we note that "LEV=1" is for invocation of the hypervisor.
what's not clear to us is - given that we are not implementing
hypervisor - should this be *also* treated as an illegal instruction?
or, should we just leave it to fall through to trap @ addr 0x0c00, and
expect the trap *there* to notice and deal with the situation?

also: if we set the HV bit in MSR (when LEV=1) section 6.5.14 p1077
which refers us back to figure 65 on p1064, will this "break" things?

also: in microwatt, i'm not seeing the remaining bits which appear [to
need to] be set.

            ctrl_tmp.msr(MSR_SF) <= '1';
            ctrl_tmp.msr(MSR_EE) <= '0';
            ctrl_tmp.msr(MSR_PR) <= '0';
            ctrl_tmp.msr(MSR_IR) <= '0';
            ctrl_tmp.msr(MSR_DR) <= '0';
            ctrl_tmp.msr(MSR_RI) <= '0';
            ctrl_tmp.msr(MSR_LE) <= '1';

these appear to be correct as defined according to figure 65 (p1063)

however the remaining actions do not seem to be implemented (p1064):

     Bits bit 5, TM, VEC, VSX, PR, FP, and PMM are set to 0.
     The TE field is set to 0b00.
     TM, FP, VEC, VSX, and bit 5 are set to 0.

question: what effect would it have - bear in mind that we are
following microwatt - if we implemented these changes to MSR?  bear in
mind that we ignore most of them at the moment (MSR.LE being one
notable exception), so the question is, in effect: does the Linux
kernel *also* ignore them?



crowd-funded eco-conscious hardware: https://www.crowdsupply.com/eoma68

More information about the libre-riscv-dev mailing list