From 7a065a1d2411c24b0a02f934e2f304df1b3d8cae Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 23 Aug 2024 21:56:15 +0200 Subject: [PATCH] adds non-vectored interrupt handler --- env/ehrenberg/init.c | 6 ++++++ env/tgc_vp | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/env/ehrenberg/init.c b/env/ehrenberg/init.c index 065b961..53c0848 100644 --- a/env/ehrenberg/init.c +++ b/env/ehrenberg/init.c @@ -92,12 +92,18 @@ void __attribute__((weak)) default_handler(void) { puts("default handler\n"); } +void __attribute__((weak)) interrupt_handler(unsigned) { + puts("interrupt handler\n"); +} + uint32_t handle_trap(uint32_t mcause, uint32_t mepc, uint32_t sp){ if ((mcause & MCAUSE_INT) && ((mcause & MCAUSE_CAUSE) == IRQ_M_EXT)) { handle_m_ext_interrupt(); // External Machine-Level interrupt from PLIC } else if ((mcause & MCAUSE_INT) && ((mcause & MCAUSE_CAUSE) == IRQ_M_TIMER)){ handle_m_time_interrupt(); + } else if(!(mcause&MCAUSE_INT)) { + interrupt_handler(mcause& ~MCAUSE_INT); } else { write(1, "trap\n", 5); _exit(1 + mcause); diff --git a/env/tgc_vp b/env/tgc_vp index 4f09dcb..5f92578 120000 --- a/env/tgc_vp +++ b/env/tgc_vp @@ -1 +1 @@ -ehrenberg/ \ No newline at end of file +ehrenberg \ No newline at end of file