1996-11-30 03:33:49 +03:00
|
|
|
/* $NetBSD: psl.h,v 1.11 1996/11/30 00:33:49 is Exp $ */
|
1994-10-26 05:01:24 +03:00
|
|
|
|
1994-04-10 06:28:14 +04:00
|
|
|
#ifndef _MACHINE_PSL_H_
|
|
|
|
#define _MACHINE_PSL_H_
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1994-01-27 00:12:12 +03:00
|
|
|
#include <m68k/psl.h>
|
1994-04-10 06:06:32 +04:00
|
|
|
|
1996-04-22 01:13:16 +04:00
|
|
|
#if defined(_KERNEL) && !defined(_LOCORE)
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
#define _debug_spl(s) \
|
|
|
|
({ \
|
|
|
|
register int _spl_r; \
|
|
|
|
\
|
|
|
|
__asm __volatile ("clrl %0; movew sr,%0; movew %1,sr" : \
|
|
|
|
"&=d" (_spl_r) : "di" (s)); \
|
|
|
|
if ((_spl_r&PSL_IPL) > ((s)&PSL_IPL)&&((s)&PSL_IPL)!=PSL_IPL1) \
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("%s:%d:spl(%d) ==> spl(%d)!!\n",__FILE__,__LINE__, \
|
1996-04-22 01:13:16 +04:00
|
|
|
((PSL_IPL&_spl_r)>>8), ((PSL_IPL&(s))>>8)); \
|
|
|
|
_spl_r; \
|
|
|
|
})
|
|
|
|
#else
|
|
|
|
/*
|
|
|
|
* Don't lower IPL below current IPL (unless new IPL is 6)
|
|
|
|
*/
|
|
|
|
#define _debug_spl(s) \
|
|
|
|
({ \
|
|
|
|
register int _spl_r; \
|
|
|
|
\
|
|
|
|
__asm __volatile ("clrl %0; movew sr,%0" : \
|
|
|
|
"&=d" (_spl_r)); \
|
|
|
|
if ((((s)&PSL_IPL) >= PSL_IPL6) || (_spl_r&PSL_IPL) < ((s)&PSL_IPL) || ((s)&PSL_IPL) <= PSL_IPL1) \
|
|
|
|
__asm __volatile ("movew %0,sr" : : "di" (s)); \
|
|
|
|
_spl_r; \
|
|
|
|
})
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define _spl_no_check(s) \
|
|
|
|
({ \
|
|
|
|
register int _spl_r; \
|
|
|
|
\
|
|
|
|
__asm __volatile ("clrl %0; movew sr,%0; movew %1,sr" : \
|
|
|
|
"&=d" (_spl_r) : "di" (s)); \
|
|
|
|
_spl_r; \
|
|
|
|
})
|
|
|
|
#if defined (DEBUGXX) /* No workee */
|
|
|
|
#define _spl _debug_spl
|
|
|
|
#else
|
|
|
|
#define _spl _spl_no_check
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define spl0() _spl(PSL_S|PSL_IPL0)
|
|
|
|
#define spl1() _spl(PSL_S|PSL_IPL1)
|
|
|
|
#define spl2() _spl(PSL_S|PSL_IPL2)
|
|
|
|
#define spl3() _spl(PSL_S|PSL_IPL3)
|
|
|
|
#define spl4() _spl(PSL_S|PSL_IPL4)
|
|
|
|
#define spl5() _spl(PSL_S|PSL_IPL5)
|
|
|
|
#define spl6() _spl(PSL_S|PSL_IPL6)
|
|
|
|
#define spl7() _spl(PSL_S|PSL_IPL7)
|
|
|
|
|
|
|
|
#define splnone() spl0()
|
|
|
|
#define splsoftclock() spl1()
|
|
|
|
#define splsoftnet() spl1()
|
|
|
|
#define splbio() spl3()
|
|
|
|
#define splnet() spl3()
|
1996-11-30 03:33:49 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* spltty hack, idea by Jason Thorpe.
|
|
|
|
* drivers which need it (at the present only drcom) raise the variable to
|
|
|
|
* spl5 (the idea being that only ser.c really wants it below 5, and ser
|
|
|
|
* and drcom will never be present at the same time).
|
|
|
|
*
|
|
|
|
* XXX ttyspl is statically initialized in drcom.c at the moment; should
|
|
|
|
* be some driver independent file.
|
|
|
|
*
|
|
|
|
* XXX should ttyspl be volatile? I think not; it is intended to be set only
|
|
|
|
* during xxx_attach() time, and will be used only later.
|
|
|
|
* -is
|
|
|
|
*/
|
|
|
|
|
|
|
|
extern u_int16_t amiga_ttyspl;
|
|
|
|
#define spltty() _spl(amiga_ttyspl)
|
|
|
|
#define splimp() spltty() /* XXX for the full story, see i386 */
|
|
|
|
|
1996-04-22 01:13:16 +04:00
|
|
|
#ifndef LEV6_DEFER
|
|
|
|
#define splclock() spl6()
|
|
|
|
#define splstatclock() spl6()
|
|
|
|
#define splvm() spl6()
|
|
|
|
#define splhigh() spl7()
|
|
|
|
#define splsched() spl7()
|
|
|
|
#else
|
|
|
|
#define splclock() spl4()
|
|
|
|
#define splstatclock() spl4()
|
|
|
|
#define splvm() spl4()
|
|
|
|
#define splhigh() spl4()
|
|
|
|
#define splsched() spl4()
|
1994-04-10 06:06:32 +04:00
|
|
|
#endif
|
1996-04-22 01:13:16 +04:00
|
|
|
|
|
|
|
#define splx(s) _spl_no_check(s)
|
|
|
|
|
|
|
|
#endif /* KERNEL && !_LOCORE */
|
|
|
|
#endif /* _MACHINE_PSL_H_ */
|