Use csr_set to set stvec

This commit is contained in:
Rodrigo Arias Mallo 2024-08-21 10:12:41 +02:00
parent 64cc2a982f
commit cc65500434

View File

@ -1,5 +1,5 @@
diff --git a/lib/sbi/sbi_irqchip.c b/lib/sbi/sbi_irqchip.c diff --git a/lib/sbi/sbi_irqchip.c b/lib/sbi/sbi_irqchip.c
index 0ae604a..0314715 100644 index 0ae604a..000b89c 100644
--- a/lib/sbi/sbi_irqchip.c --- a/lib/sbi/sbi_irqchip.c
+++ b/lib/sbi/sbi_irqchip.c +++ b/lib/sbi/sbi_irqchip.c
@@ -9,6 +9,9 @@ @@ -9,6 +9,9 @@
@ -138,7 +138,7 @@ index 0ae604a..0314715 100644
+ csr_set(CSR_SIE, SIE_SEIE); // Enable supervisor external interrupts + csr_set(CSR_SIE, SIE_SEIE); // Enable supervisor external interrupts
+ csr_set(CSR_SSTATUS, SSTATUS_SIE); // Enable global interrupts in supervisor mode + csr_set(CSR_SSTATUS, SSTATUS_SIE); // Enable global interrupts in supervisor mode
+ csr_set(CSR_MIDELEG, MIDELEG_SEIE); // Delegate machine interrupts to supervisor mode + csr_set(CSR_MIDELEG, MIDELEG_SEIE); // Delegate machine interrupts to supervisor mode
+ asm volatile("csrw stvec, %0" : : "r"(&supervisor_trap_entry)); + csr_set(CSR_STVEC, &supervisor_trap_entry);
+ sbi_printf("Enabled supervisor delegation:\n"); + sbi_printf("Enabled supervisor delegation:\n");
+ +
+ dumpregs(); + dumpregs();