This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ecos newbie question: the stack for interrupt_end()


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:
> #ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
>         // 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.

           Andrew

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]