diff --git a/opensbi-test-plic.patch b/opensbi-test-plic.patch index 17b1b50..6a900dd 100644 --- a/opensbi-test-plic.patch +++ b/opensbi-test-plic.patch @@ -1,5 +1,5 @@ diff --git a/lib/sbi/sbi_irqchip.c b/lib/sbi/sbi_irqchip.c -index 0ae604a..a3df88c 100644 +index 0ae604a..3708c3a 100644 --- a/lib/sbi/sbi_irqchip.c +++ b/lib/sbi/sbi_irqchip.c @@ -9,6 +9,9 @@ @@ -25,7 +25,7 @@ index 0ae604a..a3df88c 100644 return 0; } -@@ -47,8 +52,151 @@ void sbi_irqchip_exit(struct sbi_scratch *scratch) +@@ -47,8 +52,156 @@ void sbi_irqchip_exit(struct sbi_scratch *scratch) { const struct sbi_platform *plat = sbi_platform_ptr(scratch); @@ -117,6 +117,10 @@ index 0ae604a..a3df88c 100644 + return 0; +} + ++static void supervisor_trap_entry(void) ++{ ++ sbi_printf("\nSupervisor Trap Entry Reached!\n"); ++} + +static void do_plic_test(void) +{ @@ -134,6 +138,7 @@ index 0ae604a..a3df88c 100644 + 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_MIDELEG, MIDELEG_SEIE); // Delegate machine interrupts to supervisor mode ++ asm volatile("csrw stvec, %0" : : "r"(&supervisor_trap_entry)); + sbi_printf("Enabled supervisor delegation:\n"); + + dumpregs();