1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:47:45 +00:00

Kernel/riscv64: Don't touch reserved fields of the sstatus CSR in boot.S

Multiple fields in sstatus are defined as WPRI "Reserved Writes Preserve
Values, Reads Ignore Values", which means we have to preserve their
values when writing to other fields in the same CSR.

We don't really need to touch any fields except SIE.
Interrupts are probably already disabled, but just to be safe,
disable them explicitly.
This commit is contained in:
Sönke Holz 2024-02-05 00:27:13 +01:00 committed by Andrew Kaster
parent 433fe3dc26
commit d0e3065ced

View file

@ -16,8 +16,8 @@ start:
// Don't touch a0/a1 as we expect those registers to contain the hart ID
// and a pointer to the Flattened Fevice Tree.
// Set sstatus to a known state (which includes disabling supervisor interrupts).
csrw sstatus, zero
// Clear sstatus.SIE, which disables all interrupts in supervisor mode.
csrci sstatus, 1 << 1
// Also, disable all interrupts sources and mark them as non-pending.
csrw sie, zero