adds non-vectored interrupt handler
This commit is contained in:
parent
ac3ef788f9
commit
7a065a1d24
|
@ -92,12 +92,18 @@ void __attribute__((weak)) default_handler(void) {
|
||||||
puts("default handler\n");
|
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){
|
uint32_t handle_trap(uint32_t mcause, uint32_t mepc, uint32_t sp){
|
||||||
if ((mcause & MCAUSE_INT) && ((mcause & MCAUSE_CAUSE) == IRQ_M_EXT)) {
|
if ((mcause & MCAUSE_INT) && ((mcause & MCAUSE_CAUSE) == IRQ_M_EXT)) {
|
||||||
handle_m_ext_interrupt();
|
handle_m_ext_interrupt();
|
||||||
// External Machine-Level interrupt from PLIC
|
// External Machine-Level interrupt from PLIC
|
||||||
} else if ((mcause & MCAUSE_INT) && ((mcause & MCAUSE_CAUSE) == IRQ_M_TIMER)){
|
} else if ((mcause & MCAUSE_INT) && ((mcause & MCAUSE_CAUSE) == IRQ_M_TIMER)){
|
||||||
handle_m_time_interrupt();
|
handle_m_time_interrupt();
|
||||||
|
} else if(!(mcause&MCAUSE_INT)) {
|
||||||
|
interrupt_handler(mcause& ~MCAUSE_INT);
|
||||||
} else {
|
} else {
|
||||||
write(1, "trap\n", 5);
|
write(1, "trap\n", 5);
|
||||||
_exit(1 + mcause);
|
_exit(1 + mcause);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
ehrenberg/
|
ehrenberg
|
Loading…
Reference in New Issue