On Mon, Feb 06, 2006 at 09:30:27PM +0300, Sergei Organov wrote:
> The patch below disables FIQ in IRQ handler to fix race condition
> that may result in recursive entry into IRQ handler through FIQ
> handler.
>
> -- Sergei.
>
> Index: packages/hal/arm/arch/current/ChangeLog
> ===================================================================
> RCS file: /cvs/ecos/ecos/packages/hal/arm/arch/current/ChangeLog,v
> retrieving revision 1.104
> diff -a -u -r1.104 ChangeLog
> --- packages/hal/arm/arch/current/ChangeLog 21 Apr 2005 18:17:54 -0000
> 1.104
> +++ packages/hal/arm/arch/current/ChangeLog 6 Feb 2006 18:27:06 -0000
> @@ -1,3 +1,9 @@
> +2006-02-06 Sergei Organov <[EMAIL PROTECTED]>
> +
> + * 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.
> +
> 2005-04-21 Ian Campbell <[EMAIL PROTECTED]>
>
> * src/redboot_linux_exec.c: Added -t option which takes the
> Index: packages/hal/arm/arch/current/src/vectors.S
> ===================================================================
> RCS file: /cvs/ecos/ecos/packages/hal/arm/arch/current/src/vectors.S,v
> retrieving revision 1.55
> diff -a -u -r1.55 vectors.S
> --- packages/hal/arm/arch/current/src/vectors.S 23 Nov 2004 14:11:19
> -0000 1.55
> +++ packages/hal/arm/arch/current/src/vectors.S 6 Feb 2006 18:27:09
> -0000
> @@ -787,11 +787,14 @@
> 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
> + // We must disable FIQ here (IRQ is already disabled) as switching
> + // from IRQ to SVC mode will cheat FIQ handler and it will pass
> through
> + // the control back to us (should FIQ happen after the statement
> below)
> + // resulting in recursion that we aren't ready to handle, e.g., what
> + // we have saved on the exception stack will be clobbered.
I don't realy understand the comment.
I guess it is about getting a FIQ while handling an IRQ.
What do you mean about "cheat FIQ handler"?
How about the following comment
// When handling an IRQ we must disable FIQ. If we where to get a FIQ
// while in supervisor mode, the FIQ handling code would transforms the FIQ
// into an IRQ and call this section of code again. The stack pointer
// would be set to the beginning of the exception_stack, so clobbering
// the registers we have just saved.
Andrew