Proper masking of the mtvec CSR word using macros.

This commit is contained in:
Imbus 2025-12-10 23:18:18 +01:00
parent 75264e130d
commit ed9505ae12
2 changed files with 12 additions and 2 deletions

View file

@ -77,8 +77,8 @@ timerinit()
scratch[4] = interval;
w_mscratch((u64)scratch);
// Set the machine-mode trap handler.
w_mtvec((u64)timervec);
// Set the machine-mode trap handler. Set to direct, since scause is examined in the handler.
w_mtvec(MTVEC_VALUE((u64)timervec, MTVEC_MODE_DIRECT));
// Enable machine-mode interrupts.
w_mstatus(r_mstatus() | MSTATUS_MIE);