Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: riscv: Fix logic of thread_{get/set}_exceptions()
In ARM, the bits in DAIF register are used to mask the interrupts. While in RISC-V, the bits in CSR MIE/SIE are used to enable(unmask) corresponding interrupt sources. To not modify the function of thread_get_exceptions(), we invert the bits after reading the value of CSR MIE/SIE, as mask. To not modify the function of thread_set_exceptions(), we invert the bits in given "exceptions" before writing "exceptions" into CSR MIE/SIE. Therefore, the intended masked exception bits will be cleared when we write the final value into CSR MIE/SIE to mask those interrupts. Signed-off-by: Alvin Chang <alvinga@andestech.com>
- Loading branch information