This is the mail archive of the ecos-patches@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: Knowing current context


David Brennan <eCos@brennanhome.com> writes:

> For our application, it is desirable to know if a section of code is
> running in interrupt context. (Specifically we have a custom assert
> function, and our arrays are protected, so if the interrupt routine
> goes out of bounds on the array, the assert will fire. We are in the
> process of writing a custom "print" function that can be used in
> interrupt context, but we only want it to work in interrupt context,
> otherwise we will use our normal messaging system.) This code performs
> that function. (Although it requires platform specific implementation
> in vectors.S, which I provided for i386.) I went ahead and put DSR
> tracking in also, although it is not as necessary for our application.


I don't really like this. It is even more overhead in the interrupt
path that we really don't want. Those increments are likely to cause
cache misses and make interrupt handling even slower.

There's no operational reason for eCos to need to keep track of this
stuff so I don't think it should be part of eCos. If you want to keep
track of interrupt or DSR calls, they can do this in application
code. Each ISR and DSR can increment/decrement the counters as
appropriate.

There are other ways of detecting whether you are in an ISR. For
example by comparing the address of a local variable with the range of
the interrupt stack.

What does your custom print do that diag_printf() cannot? I would
question any system design that required any kind of printing from
ISRs.

Of course you are free to make any changes to the HAL and the rest of
eCos in your own sources. However, I'm not happy about accepting this
back into the main sources.


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


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