Subject: Re: how do I tell if I'm on the interrupt stack?
To: Darren Reed <darrenr@reed.wattle.id.au>
From: Greg Lehey <grog@lemis.com>
List: tech-kern
Date: 09/06/2001 11:48:34
On Thursday,  6 September 2001 at 12:08:54 +1000, Darren Reed wrote:
> In some email I received from Greg Lehey, sie wrote:
>> On Wednesday,  5 September 2001 at 20:46:35 -0400, Bill Sommerfeld wrote:
>>>> Correct me if I'm wrong, but IIUC processes run with all interrupts
>>>> enabled.
>>>
>>> you're wrong ;-).  interrupts are masked by splwhatever()/splx()
>>
>> I stand corrected.
>>
>> Matt has a good point, though.  How about something like FreeBSD's
>> intr_nesting_level?
>
> Personally, I think a global variable like that is a terrible hack.

If it were just for that purpose, it would be a hack.  FreeBSD uses it
to decide whether to process a non-masked interrupt immediately, or to
defer it until after the currently active ones have been processed.

> I can see how it would be useful but good code design should remove
> the need for it to be present.  I'd much prefer to see different
> entry points pass information along about the current context in
> which it is running.

Hmm.  In the cases I'm thinking of, that means gratuitous repetition
of code.  In my book, that's a hack too.

Greg
--
Finger grog@lemis.com for PGP public key
See complete headers for address and phone numbers