Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Mar 2001 16:59:30 -0800 (PST)
From:      Matthew Jacob <mjacob@feral.com>
To:        Terry Lambert <tlambert@primenet.com>
Cc:        arch@FreeBSD.ORG
Subject:   man pages/more formal def enable_intr/disable_intr/restore_intr
Message-ID:  <Pine.LNX.4.21.0103161637510.773-100000@zeppo.feral.com>
In-Reply-To: <200103170032.RAA20020@usr07.primenet.com>

next in thread | previous in thread | raw e-mail | index | archive | help

Well, you put it marginally nicer than at least one other person.

I don't entirely agree with you- in particular of "how to use" because one
should try and be broad if you don't know the exact usage down the line, but
let's cut this short.

How's this...(paren comments in, duh, parentheses)

1. Formal Definition

disable_intr: Disables interrupts being dispatched to at least the calling
              CPU. Returns an intrmask_t (should probably be an opaque type)
              to be possibly used in a future call to restore_intr.

restore_intr: Restores the state prior to the call to disable_intr such that
              the calling CPU now can have interrupts dispatched to it.

enable_intr: Irrespective of any prior state, enables interrupts to be
             dispatched to the calling CPU.

(this narrows things down)

2. Where it might be used (generic)

The function disable_intr can and should be used when core platform code
wishes to not even allow for the possibility of interrupts to be dispatched to
a specific CPU.

The function restore_intr restores the state prior to the call to
disable_intr. Clearly it is symmetric to disable_intr.

The function enable_intr enables the dispatch of interrupts and you use it
when you have absolutely no idea whether interrupts are disabled or enabled
currently but you want them enabled.

3. How it might be used (an example)

It likely would be used (don't frickin nitpick on the details):

disable_intr: The very first line in machine dependent startup..
enable_intr:  Just prior to calling interrupt driven configuration
              during startup

disable_intr/restore_intr:  callout from the kernel to PROM code (OBP, PAL)

I can think of a half dozen other places it might be used...

4. Suggested Implementations:

ia32: save_flags, cli/sti restore_flags (sorry- I only know linux usage here)

alpha:	alpha_pal_swpipl(ALPHA_PSL_IPL_HIGH),
	alpha_pal_swpipl(x)
	alpha_pal_swpipl(ALPHA_PSL_IPL_0)

sparc:

	mov	%psr, %o0		| get current %psr
        or      %o0, PSR_PIL, %o0       ! spl8 
        mov     %o0, %psr               ! update psr
        wr      %o0, PSR_ET, %psr       ! turn on traps (mask IU bug)
        nop                             ! psr delay
        nop                             ! psr delay
        nop                             ! psr delay
	retl				! return
	nop				! nuthin to do in delay slot

	...



Does this help? If not, just leave it noted that I'm not satisfying you and
we'll move on.



-matt




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.21.0103161637510.773-100000>