Home | History | Annotate | Line # | Download | only in include
psl.h revision 1.9
      1 /*	$NetBSD: psl.h,v 1.9 1996/10/10 23:56:47 christos Exp $	*/
      2 
      3 #ifndef _MACHINE_PSL_H_
      4 #define _MACHINE_PSL_H_
      5 
      6 #include <m68k/psl.h>
      7 
      8 #if defined(_KERNEL) && !defined(_LOCORE)
      9 
     10 #if 0
     11 #define _debug_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 	if ((_spl_r&PSL_IPL) > ((s)&PSL_IPL)&&((s)&PSL_IPL)!=PSL_IPL1) \
     18 		kprintf ("%s:%d:spl(%d) ==> spl(%d)!!\n",__FILE__,__LINE__, \
     19 		    ((PSL_IPL&_spl_r)>>8), ((PSL_IPL&(s))>>8)); \
     20         _spl_r; \
     21 })
     22 #else
     23 /*
     24  * Don't lower IPL below current IPL (unless new IPL is 6)
     25  */
     26 #define _debug_spl(s) \
     27 ({ \
     28         register int _spl_r; \
     29 \
     30         __asm __volatile ("clrl %0; movew sr,%0" : \
     31                 "&=d" (_spl_r)); \
     32 	if ((((s)&PSL_IPL) >= PSL_IPL6) || (_spl_r&PSL_IPL) < ((s)&PSL_IPL) || ((s)&PSL_IPL) <= PSL_IPL1) \
     33 		__asm __volatile ("movew %0,sr" : : "di" (s)); \
     34         _spl_r; \
     35 })
     36 #endif
     37 
     38 #define _spl_no_check(s) \
     39 ({ \
     40         register int _spl_r; \
     41 \
     42         __asm __volatile ("clrl %0; movew sr,%0; movew %1,sr" : \
     43                 "&=d" (_spl_r) : "di" (s)); \
     44         _spl_r; \
     45 })
     46 #if defined (DEBUGXX)		/* No workee */
     47 #define _spl _debug_spl
     48 #else
     49 #define _spl _spl_no_check
     50 #endif
     51 
     52 #define spl0()	_spl(PSL_S|PSL_IPL0)
     53 #define spl1()	_spl(PSL_S|PSL_IPL1)
     54 #define spl2()	_spl(PSL_S|PSL_IPL2)
     55 #define spl3()	_spl(PSL_S|PSL_IPL3)
     56 #define spl4()	_spl(PSL_S|PSL_IPL4)
     57 #define spl5()	_spl(PSL_S|PSL_IPL5)
     58 #define spl6()	_spl(PSL_S|PSL_IPL6)
     59 #define spl7()	_spl(PSL_S|PSL_IPL7)
     60 
     61 #define splnone()	spl0()
     62 #define splsoftclock()	spl1()
     63 #define splsoftnet()	spl1()
     64 #define splbio()	spl3()
     65 #define splnet()	spl3()
     66 #define spltty()	spl4()
     67 #define splimp()	spl4()
     68 #ifndef LEV6_DEFER
     69 #define splclock()	spl6()
     70 #define splstatclock()	spl6()
     71 #define splvm()		spl6()
     72 #define splhigh()	spl7()
     73 #define splsched()	spl7()
     74 #else
     75 #define splclock()	spl4()
     76 #define splstatclock()	spl4()
     77 #define splvm()		spl4()
     78 #define splhigh()	spl4()
     79 #define splsched()	spl4()
     80 #endif
     81 
     82 #define splx(s)		_spl_no_check(s)
     83 
     84 #endif	/* KERNEL && !_LOCORE */
     85 #endif	/* _MACHINE_PSL_H_ */
     86