fix interrupt handler and Moonlight ROM size

This commit is contained in:
2024-09-26 12:18:50 +02:00
parent ea5d61ec0b
commit 3484dc66e3
3 changed files with 75 additions and 60 deletions

15
env/ehrenberg/init.c vendored
View File

@ -97,13 +97,14 @@ void __attribute__((weak)) interrupt_handler(unsigned) {
}
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);
if ((mcause & MCAUSE_INT)) {
if ((mcause & MCAUSE_CAUSE) == IRQ_M_EXT) {
handle_m_ext_interrupt();
} else if (((mcause & MCAUSE_CAUSE) == IRQ_M_TIMER)){
handle_m_time_interrupt();
} else {
interrupt_handler(mcause& ~MCAUSE_INT);
}
} else {
write(1, "trap\n", 5);
_exit(1 + mcause);

View File

@ -4,7 +4,7 @@ ENTRY( _start )
MEMORY
{
rom (rxai!w) : ORIGIN = 0xF0080000, LENGTH = 1k
rom (rxai!w) : ORIGIN = 0xF0080000, LENGTH = 4k
ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 32k
}