1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:37:34 +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 // Don't touch a0/a1 as we expect those registers to contain the hart ID
// and a pointer to the Flattened Fevice Tree. // and a pointer to the Flattened Fevice Tree.
// Set sstatus to a known state (which includes disabling supervisor interrupts). // Clear sstatus.SIE, which disables all interrupts in supervisor mode.
csrw sstatus, zero csrci sstatus, 1 << 1
// Also, disable all interrupts sources and mark them as non-pending. // Also, disable all interrupts sources and mark them as non-pending.
csrw sie, zero csrw sie, zero