Reputation: 33
I was trying to enable Interrupts for an ARMv7A mcu (Cortex-A8) and I noticed I can't change the I bit in the CPSR
register in user mode no matter what I try. I read around a bit and it seems like this is because I am in USR mode.
Is the only solution to call an SWI and change the SPSR
in the SWI handler?
Upvotes: 2
Views: 543
Reputation: 107769
Indeed you cannot disable or enable interrupts in user mode. You can only do it in a privileged mode.
It's unusual to switch to user mode with interrupts disabled. Normally you only run a very small amount of code with interrupts disabled, since that delays the handling of the next interrupt. If you run part of an interrupt handler in user mode, first do whatever has to be done before re-enabling interrupts, and then switch to user mode.
Upvotes: 1