mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 10:13:56 -06:00
target/xtensa: fix access to the INTERRUPT SR
INTERRUPT special register may be changed both by the core (by writing to INTSET and INTCLEAR registers) and by external events (by triggering and clearing HW IRQs). In MTTCG this state must be protected from concurrent access, otherwise interrupts may be lost or spurious interrupts may be detected. Use atomic operations to change INTSET SR. Fix wsr.intset so that it soesn't clear any bits. Fix wsr.intclear so that it doesn't clear bit that corresponds to NMI. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
This commit is contained in:
parent
fff7bf1450
commit
fa92bd4af7
5 changed files with 21 additions and 14 deletions
|
@ -68,9 +68,9 @@ static void xtensa_set_irq(void *opaque, int irq, int active)
|
|||
uint32_t irq_bit = 1 << irq;
|
||||
|
||||
if (active) {
|
||||
env->sregs[INTSET] |= irq_bit;
|
||||
atomic_or(&env->sregs[INTSET], irq_bit);
|
||||
} else if (env->config->interrupt[irq].inttype == INTTYPE_LEVEL) {
|
||||
env->sregs[INTSET] &= ~irq_bit;
|
||||
atomic_and(&env->sregs[INTSET], ~irq_bit);
|
||||
}
|
||||
|
||||
check_interrupts(env);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue