openrisc / mor1kx

mor1kx - an OpenRISC 1000 processor IP core
Other
491 stars 147 forks source link

Global IRQ disable in ISR does not work #28

Closed wwwweb closed 9 years ago

wwwweb commented 9 years ago

When clearing SR_SPR[SR_SPR_IEE] within an ISR (using or1k_interrupts_disable() from or1k-support.h), the global irq disable (which this bit represents) seems to be overwritten by the restoring from spr_sr[14:0] <= spr_esr[14:0] in mor1kx_ctrl_cappuccino.v when leaving the ISR. So the IRQs are effectively not disabled.

My workaround for now is just not to restore sr_spr[SR_SPR_IEE] from spr_esr but I am relatively new to OpenRISC and may not see all implications this includes. Also I believe now it is not possible to do any manipulations of the SR within an ISR that are not overwritten when leaving the ISR?

Best regards, wwwweb

skristiansson commented 9 years ago

Yes, this is intentional. Any changes to SR within an exception handler will and should be overwritten with ESR upon return from exception. If you really wish to impose changes to SR done in the exception handler to the pre-exception SR, you'll have to update ESR before issuing an l.rfe.