rars
rars copied to clipboard
Delegate exceptions based on medeleg
This PR implements exception delegation based on medeleg as well as a UI setting to either delegate all or no exceptions.
This fixes #96
Thanks for taking a stab at implementing this.
Some minor problems:
medelegdoesn't have any hint text.- trying to read
medelegshould throw an illegal instruction exception- This might merit a new type of register that is only viewable/modifiable from GUI / internal code.
- It might be interesting to have
medelegjust not reset its value and remove the setting.
ecall(only if there is a valid system call) andebreakbypass the normal exception trap handler.
Additionally I think the handling of exception traps is incorrect in two ways:
- If
utvec = 0, the normal error message should not be used. Instead it should either enter a tight loop or output a message about the trap handler address being invalid. - It should not set
UPIE = 1. Instead it should setUPIE = UIE.
The csr test would be unable to pass if the ecall issue were fixed. Neither default value of medeleg would let it detect invalid CSRs and actually signal completion.
It seems like no progress is currently being made on this. I plan to address the problems myself.
I plan to make a new class of register that is only read/writeable internally and persists its value across assembly; medeleg will be an instance of this. I will also remove the setting for delegating everything; if you are using the GUI and want something delegated, just set the value manually once per startup. Support for changing medeleg from the CLI will be left for a later time. The automated tests can set medeleg to whatever is needed to correctly test behavior. ecall and ebreak correctness will also be left for a later time. I plan to fix the exception handling issues and hint text issues.
It seems like no progress is currently being made on this. I plan to address the problems myself.
Apologies, I somehow completely lost track of this and only noticed your responses now. Since you are going to address this yourself, I will close this PR.