1 /* $NetBSD: psl.h,v 1.6 1996/05/05 06:17:57 briggs 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 /* These should be used for: 30 1) ensuring mutual exclusion (why use processor level?) 31 2) allowing faster devices to take priority 32 33 Note that on the mac, most things are masked at spl1, almost 34 everything at spl2, and everything but the panic switch and 35 power at spl4. 36 */ 37 #define splsoftclock() spl1() /* disallow softclock */ 38 #define splsoftnet() spl1() /* disallow network */ 39 #define spltty() spl1() /* disallow tty (softserial&adb) interrupts */ 40 #define splbio() spl2() /* disallow block I/O */ 41 #define splnet() spl2() /* disallow network */ 42 #define splimp() spl2() /* disallow imput */ 43 #define splclock() spl2() /* disallow clock & other interrupts */ 44 #define splstatclock() spl2() /* ditto */ 45 #define splhigh() spl7() /* disallow everything */ 46 #define splsched() spl7() /* disallow scheduling */ 47 48 /* watch out for side effects */ 49 #define splx(s) ((s) & PSL_IPL ? _spl(s) : spl0()) 50 51 int spl0 __P((void)); 52 53 #endif /* _KERNEL && !_LOCORE */ 54 55 #endif /* ndef PSL_C */ 56