Commit 3ac734e1 authored by YenHaoChen's avatar YenHaoChen
Browse files

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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment