提交 22a9c26a 编写于 作者: P Peter Maydell

nvic: Don't apply group priority mask to negative priorities

In several places we were unconditionally applying the
nvic_gprio_mask() to a priority value. This is incorrect
if the priority is one of the fixed negative priority
values (for NMI and HardFault), so don't do it.

This bug would have caused both NMI and HardFault to be
considered as the same priority and so NMI wouldn't
correctly preempt HardFault.
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
Reviewed-by: NRichard Henderson <richard.henderson@linaro.org>
Message-id: 1505137930-13255-5-git-send-email-peter.maydell@linaro.org
上级 c6158878
......@@ -152,8 +152,12 @@ static void nvic_recompute_state(NVICState *s)
}
}
if (active_prio > 0) {
active_prio &= nvic_gprio_mask(s);
}
s->vectpending = pend_irq;
s->exception_prio = active_prio & nvic_gprio_mask(s);
s->exception_prio = active_prio;
trace_nvic_recompute_state(s->vectpending, s->exception_prio);
}
......@@ -329,7 +333,10 @@ void armv7m_nvic_acknowledge_irq(void *opaque)
assert(vec->enabled);
assert(vec->pending);
pendgroupprio = vec->prio & nvic_gprio_mask(s);
pendgroupprio = vec->prio;
if (pendgroupprio > 0) {
pendgroupprio &= nvic_gprio_mask(s);
}
assert(pendgroupprio < running);
trace_nvic_acknowledge_irq(pending, vec->prio);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册