This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: ARM vector.s -- suspicious code in return_from_exception
- From: "Gary Thomas" <gary at chez-thomas dot org>
- To: "Mark Salter" <msalter at redhat dot com>
- Cc: list_ericdejong_10 at gmx dot net, ecos-discuss at sources dot redhat dot com
- Date: Wed, 2 Jul 2003 07:58:36 -0600 (MDT)
- Subject: Re: [ECOS] ARM vector.s -- suspicious code in return_from_exception
- References: <Law15-F23Bi89QtpfTY0002badf@hotmail.com> <20030630122544.DF42D78859@deneb.localdomain> <003601c33f10$38b8d610$e33922c7@ericnt> <20030702135141.873E978859@deneb.localdomain>
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