This is the mail archive of the ecos-discuss@sourceware.org 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 interrupt handling


Wilson Tsao <Wilson.Tsao@iteusa.com> writes:

> Hi,
> 
> I am porting eCos to my company's own platform. We are using MIPS 4KEp as
> our processor.
> I modified some of the HAL files to fit our processor. But I found some
> problems regrading the interuupt
> handling. Very likely the problems are caused by my modifications.
> 
> In my interrupt DSR, it writes mailbox to wake up a thread which is waiting
> for mailbox event. But I saw
> the thread is waken up and running while HAL default interrupt VSR is not
> returned yet (eret is not called yet).
> I thought the scheduler should decide which thread to run after the whole
> interrupt is completed, includes
> HAL default VSR, ISR, DSR, and restore_state. Can someone give me some
> directions what could go wrong?

This will happen if the thread you are waking up is higher priority
that the thread that was interrupted.

When an interrupt occurs the thread's state is saved on its own stack,
a switch is made to the interrupt stack and the ISR called. When the
ISR returns we switch back to the thread's stack and call
interrupt_end(). This arranges for the DSR to be posted and then, if
the scheduler lock allows, calls it. If this causes a higher priority
thread to be woken up then the context switch to this thread will
happen in interrupt_end(). Only when the current thread becomes the
highest priority thread again will interrupt_end() return and restore
the thread's state from its stack. So, restore_state can happen long
after the original interrupt.

-- 
Nick Garnett                                     eCos Kernel Architect
http://www.ecoscentric.com                The eCos and RedBoot experts


-- 
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]