Skip to content

Commit

Permalink
arch: arm: aarch32: Fix spurious interrupt handling
Browse files Browse the repository at this point in the history
The GIC can return 0x3ff to indicate a spurious interrupt.  Other
interrupt controllers could return something different.  Check that the
pending interrupt is valid in order to avoid indexing past the end of
the isr_table.

This fixes zephyrproject-rtos#30465 and is based on the aarch64 fix in 9dd2731.

Signed-off-by: Bradley Bolen <bbolen@lexmark.com>
  • Loading branch information
Bradley Bolen committed Apr 19, 2021
1 parent 0b63a96 commit 1a533db
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions arch/arm/core/aarch32/isr_wrapper.S
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ _idle_state_cleared:
* interface function.
*/
cpsie i

/*
* Skip calling the isr if it is a spurious interrupt.
*/
mov r1, #CONFIG_NUM_IRQS
lsl r1, r1, #3
cmp r0, r1
bge spurious_continue
#endif /* !CONFIG_CPU_CORTEX_M */

ldr r1, =_sw_isr_table
Expand All @@ -193,6 +201,7 @@ _idle_state_cleared:
blx r3 /* call ISR */

#if defined(CONFIG_CPU_CORTEX_R)
spurious_continue:
/* Signal end-of-interrupt */
pop {r0, r1}
#if !defined(CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER)
Expand Down

0 comments on commit 1a533db

Please sign in to comment.