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: ARM vector.s -- suspicious code in return_from_exception


Mark Salter said:
>>>>>> Eric de Jong writes:
>
>> Thanks for the patch mark.
>> Now how about the following case:
>> timer interrupt occurs, return_from_exception is called, spsr is written, ....
>> and another interrupt occures.
>
> Hmm, after staring at this for a while, I think you have found
> another problem. IRQs are disabled (or should be) at the time
> return_from_exception is run. FIQs, however, are possible. That
> is a bug I think. At least its a bug as long as the HAL treats
> FIQ and IRQ equally as is the current case.
>
> We probably haven't been bitten by this because I don't think we
> have any boards that make much use of FIQ.
>

Most boards I've used with FIQ use their own VSR anyway.

>> As I understand interrupts are enabled during
>> task switches (but I still never found out where :-) ) and at least the fiq can
>> interrupt the code. This will mess-up the spsr in supervisor mode. This makes it
>> more important not to use spsr when interrupts are enabled.
>
> Tasks are created with interrupts enabled (see HAL_THREAD_INIT_CONTEXT).
> When task switches occur (HAL_THREAD_SWITCH_CONTEXT), the task being
> switched in inherits the same interrupt enable/disable state as it had
> when it was switched out. None of this has anything to do with the
> exception/interrupt handling in vectors.S.
>
> Anyway, I think this patch fixes the problem you note above. I'll defer
> checking it in to give others a chance to comment.
>

This looks correct to me.  IIRC, this is closer to how the code used
to look before the recent changes which attempted to make the interrupt
code more general.


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


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