Home | History | Annotate | Line # | Download | only in include
psl.h revision 1.7
      1 /*	$NetBSD: psl.h,v 1.7 1996/05/06 06:19:33 scottr Exp $	*/
      2 
      3 #ifndef PSL_C
      4 #include <m68k/psl.h>
      5 
      6 #if defined(_KERNEL) && !defined(_LOCORE)
      7 /*
      8  * spl functions; all but spl0 are done in-line
      9  */
     10 
     11 #define _spl(s) \
     12 ({ \
     13         register int _spl_r; \
     14 \
     15         __asm __volatile ("clrl %0; movew sr,%0; movew %1,sr" : \
     16                 "&=d" (_spl_r) : "di" (s)); \
     17         _spl_r; \
     18 })
     19 
     20 /* spl0 requires checking for software interrupts */
     21 #define spl1()  _spl(PSL_S|PSL_IPL1)
     22 #define spl2()  _spl(PSL_S|PSL_IPL2)
     23 #define spl3()  _spl(PSL_S|PSL_IPL3)
     24 #define spl4()  _spl(PSL_S|PSL_IPL4)
     25 #define spl5()  _spl(PSL_S|PSL_IPL5)
     26 #define spl6()  _spl(PSL_S|PSL_IPL6)
     27 #define spl7()  _spl(PSL_S|PSL_IPL7)
     28 
     29 /*
     30  * These should be used for:
     31  * 1) ensuring mutual exclusion (why use processor level?)
     32  * 2) allowing faster devices to take priority
     33  *
     34  * Note that on the Mac, most things are masked at spl1, almost
     35  * everything at spl2, and everything but the panic switch and
     36  * power at spl4.
     37  */
     38 #define	splsoftclock()	spl1()	/* disallow softclock */
     39 #define	splsoftnet()	spl1()	/* disallow network */
     40 #define	spltty()	spl1()	/* disallow tty (softserial & ADB) */
     41 #define	splbio()	spl2()	/* disallow block I/O */
     42 #define	splnet()	spl2()	/* disallow network */
     43 #define	splimp()	spl2()	/* disallow goblins and other nonsense */
     44 #define	splclock()	spl2()	/* disallow clock (and other) interrupts */
     45 #define	splstatclock()	spl2()	/* ditto */
     46 #define	splhigh()	spl7()	/* disallow everything */
     47 #define	splsched()	spl7()	/* disallow scheduling */
     48 
     49 /* watch out for side effects */
     50 #define splx(s)         ((s) & PSL_IPL ? _spl(s) : spl0())
     51 
     52 int	spl0 __P((void));
     53 
     54 #endif /* _KERNEL && !_LOCORE */
     55 
     56 #endif /* ndef PSL_C */
     57