adds non-vectored interrupt handler

This commit is contained in:
Eyck Jentzsch 2024-08-23 21:56:15 +02:00
parent ac3ef788f9
commit 7a065a1d24
2 changed files with 7 additions and 1 deletions

View File

@ -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);

2
env/tgc_vp vendored
View File

@ -1 +1 @@
ehrenberg/
ehrenberg