1 /* $NetBSD: psl.h,v 1.12 1996/09/12 20:39:19 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() /* mutual exclusion for memory allocation */ 44 #define splclock() spl2() /* disallow clock (and other) interrupts */ 45 #define splstatclock() spl2() /* ditto */ 46 #define splzs() spl4() /* disallow serial hw interrupts */ 47 #define spladb() spl7() /* disallow adb interrupts */ 48 #define splhigh() spl7() /* disallow everything */ 49 #define splsched() spl7() /* disallow scheduling */ 50 51 /* watch out for side effects */ 52 #define splx(s) ((s) & PSL_IPL ? _spl(s) : spl0()) 53 54 int spl0 __P((void)); 55 56 #endif /* _KERNEL && !_LOCORE */ 57 58 #endif /* ndef PSL_C */ 59