diff packages/hal/arm/arch/current/src/vectors.S @ 2126:0141a9e24d21

* src/vectors.S: disable FIQ in IRQ handler to fix race condition recursively entering IRQ handler through FIQ handler. Remove unreferenced handle_IRQ_or_FIQ label.
author asl
date Thu, 09 Feb 2006 16:47:39 +0000
parents a10cfd6a2ddc
children f0b2da61ab63
line wrap: on
line diff
--- a/packages/hal/arm/arch/current/src/vectors.S
+++ b/packages/hal/arm/arch/current/src/vectors.S
@@ -787,11 +787,16 @@ IRQ:
         mov     r2,#CYGNUM_HAL_VECTOR_IRQ
         mov     r3,sp
 	
-handle_IRQ_or_FIQ:
-
         mrs     r4,cpsr                 // switch to Supervisor Mode
         bic     r4,r4,#CPSR_MODE_BITS
-        orr     r4,r4,#CPSR_SUPERVISOR_MODE
+        // When handling an IRQ we must disable FIQ unless the current 
+        // mode in CPSR is IRQ. If we were to get a FIQ while in another 
+        // mode, the FIQ handling code would transform the FIQ into an 
+        // IRQ and call the non-reentrant IRQ handler again. As a result, 
+        // for example, the stack pointer would be set to the beginning 
+        // of the exception_stack clobbering the registers we have just 
+        // saved.
+        orr     r4,r4,#CPSR_SUPERVISOR_MODE|CPSR_FIQ_DISABLE
         msr     cpsr,r4
 
         mov     r5,sp                   // save original svc sp