Subject: Re: how to detect if kernel is running in interrupt ctx
To: Ming Lei <>
From: Matt Thomas <>
List: tech-kern
Date: 06/29/2003 23:48:08
At 10:25 PM 6/29/2003, you wrote:

>sometimes a code segment may be used by both ISR or normal kernel code. ISR
>doesnt live in user context, so cannot block or sleep. In normal kernel
>code, the code can block or sleep. Malloc flag is one example.

Then make the caller pass in whether it can sleep or not.  At some point
your code must know because of the type of code it is whether it can sleep
or not.

>Is there any way to detect if the code is running in interrupt, even in a
>archtect dependent way, such as, cpu register?

But NetBSD doesn't want such methods in its drivers for obvious reasons.

Matt Thomas               Internet:
3am Software Foundry      WWW URL:
Cupertino, CA             Disclaimer: I avow all knowledge of this message