[ECOS] ecos newbie question: the stack for interrupt_end()

Andrew Lunn andrew@lunn.ch
Sun Apr 11 11:59:00 GMT 2004

On Fri, Apr 09, 2004 at 02:51:12PM +0800, wyb wrote:
> In arm HAL, the following code said that interrupt_end() should be called on
> the thread stack.
> =========================================
> spurious_IRQ:
>         // If we are returning from the last nested interrupt, move back
>         // to the thread stack. interrupt_end() must be called on the
>         // thread stack since it potentially causes a context switch.
>         ldr     r2,.irq_level
>         ldr     r3,[r2]
>         subs    r1,r3,#1
>         str     r1,[r2]
>         ldreq   sp,[sp]         // This should be the saved stack pointer
> #endif
> ==========================================
> But if the thread was in user mode, the "ldreq sp, [sp]" still loaded SP
> with svc_sp,not usr_sp.

The thread should not be in user mode. eCos runs everything in
supervisor mode.


Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list