Fix tval on illegal instruction faults with long illegal instruction
The current spike implementation does not include the ILEN (maximum instruction length supported by the implementation), which is required to constrain the value of tval on an illegal instruction exception. Consider an implementation supporting only an RV64I base instruction set. The ILEN is 32 bits (spec sec. 1.5), and the MXLEN is 64 bits (spec sec. 5.1). Under an illegal instruction exception with the instruction longer than the ILEN, the mtval should contain the first ILEN (32 bits) of the faulting instruction. However, the current spike implementation lets the mtval be the instruction's first MXLEN (64 bits). To fix this bug, this PR masks out the upper bits of the tval and leaves the first ILEN bits of the faulting instruction. When this PR is being made, all official instructions are either 16 or 32 bits. So, We hard- code the ILEN to 32 bits.
parent
07b30ea4
Please register or sign in to comment