changes to the core Nios2 RTEMS IIC model

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Aug 15 09:24:39 UTC 2012


Hello Jeff,

some more comments regarding the thread stack usage of ISRs.

On 14/08/12 03:05, Hill, Jeff wrote:
> __attribute__ ((section (".text_hotspot")))
> void __ISR_Handler ( void )
> {
>
[...]

The code that calls __ISR_Handler() will save the volatile context on 
the thread stack, right?

>    if ( _ISR_Nest_level == 0) {
> #   if( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
>        stack_ptr = _old_stack_ptr;
> #   endif
>
>      if ( !_Thread_Dispatch_in_critical_section() ) {
>        if ( _Thread_Is_dispatch_necessary () ) {
>          _CPU_ISR_Enable ( isrCookie );

What does the _CPU_ISR_Enable() here?  Will it really enable the 
interrupts?  In case it enables interrupts then the code that calls 
__ISR_Handler() will save a volatile context on the thread stack (it is 
now the second).  In case the interrupt is pending a long time (some 
sort of error) or you have a bad sequence of interrupts, then this can 
stack several times and blow your thread stack.

>          _Thread_Dispatch ();
>          /* may have switched to another task and not return here immed. */
>          _CPU_ISR_Disable ( isrCookie ); /* Keep _pairs_  of Enable/Disable */
>        }
>      }
>    }
>
>    _CPU_ISR_Enable( isrCookie );
> }


-- 
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




More information about the users mailing list