Incorrect logic in ARMv7M interrupt handler
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
On ARMv7M interrupts handlers will be called even if emulated code executes "cpsid i" instruction.
Underlying cause described below:
In cpu-exec.c:cpu_exec there is a block of code that determines if an interrupt should be raised or not:
I'm not convinced the logic is correct.
The logic for ARMv7M should be:
If an interrupt is pending (interrupt_request & CPU_INTERRUPT_HARD)
AND
Interrupts are not disabled ( !(env->
AND
PC doesn't have a magic value (env->regs[15] < 0xfffffff0)
The current logic seems fires the interrupt if interrupts are enabled OR the PC isn't magic, which is basically all the time.
I'm not sure what the cleanest patch for this would be.
On 17 September 2013 11:44, benno <email address hidden> wrote:
> I'm not convinced the logic is correct.
It's not. There have been a few attempts by people to submit patches lists.nongnu. org/archive/ html/qemu- devel/2013- 05/msg04546. html
to this though, but none of them have actually been sufficiently
convincing. See for instance
http://
If somebody produces a patch which comes with a good rationale
for its change (ie with reference to the architecture manual and to
what QEMU means when it sets "CPSR_I" on M profile) I'll apply
it. But because the v7M code is currently not really maintained and
v7M interrupts are complex I'm reluctant to apply patches which
only come with "seems to fix things for me" levels of justification.
-- PMM