From owner-freebsd-arch Fri Mar 16 16:59:38 2001 Delivered-To: freebsd-arch@freebsd.org Received: from feral.com (feral.com [192.67.166.1]) by hub.freebsd.org (Postfix) with ESMTP id 48B4137B719 for ; Fri, 16 Mar 2001 16:59:32 -0800 (PST) (envelope-from mjacob@feral.com) Received: from zeppo.feral.com (IDENT:mjacob@zeppo [192.67.166.71]) by feral.com (8.9.3/8.9.3) with ESMTP id QAA25151; Fri, 16 Mar 2001 16:59:34 -0800 Date: Fri, 16 Mar 2001 16:59:30 -0800 (PST) From: Matthew Jacob Reply-To: mjacob@feral.com To: Terry Lambert Cc: arch@FreeBSD.ORG Subject: man pages/more formal def enable_intr/disable_intr/restore_intr In-Reply-To: <200103170032.RAA20020@usr07.primenet.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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