adds non-vectored interrupt handler
This commit is contained in:
parent
ac3ef788f9
commit
7a065a1d24
6
env/ehrenberg/init.c
vendored
6
env/ehrenberg/init.c
vendored
@ -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
2
env/tgc_vp
vendored
@ -1 +1 @@
|
||||
ehrenberg/
|
||||
ehrenberg
|
Loading…
Reference in New Issue
Block a user