3 * Author: Avadis Tevanian, Jr.
5 * Define inline macros for spl routines.
9 * 14-May-90 Gregg Kellogg (gk) at NeXT
10 * Changed SPLCLOCK from 6 to 3, as much scheduling code expects
11 * splclock() == splsched(). Added splusclock().
13 * 19-Jun-89 Mike DeMoney (mike) at NeXT
14 * Modified to allow spl assertions in spl_measured.h
17 #ifndef _KERNSERV_M68K_SPL_H_
18 #define _KERNSERV_M68K_SPL_H_
23 /* #import <mach/features.h> */
26 #import <bsd/m68k/psl.h>
28 #if NIPLMEAS && !defined(NO_IPLMEAS)
29 #import <machdep/m68k/spl_measured.h>
30 #endif NIPLMEAS && !defined(NO_IPLMEAS)
35 #define SPLU_MACRO(ipl) \
37 movw \#((ipl)*256 + 0x2000),sr;
45 #define SPLU_MACRO(x) \
46 ({ register short ret; \
47 asm volatile ("movw sr,%0" : "=dm" (ret)); \
48 asm volatile ("movw %1,sr" : "=m" (*(char *)0): "Jdm" ((short)(x)*256+0x2000)); \
53 ({ register short ret; \
54 asm volatile ("movw sr,%0" : "=dm" (ret)); \
55 asm volatile ("movw %1,sr" : "=m" (*(char *)0): "Jdm" ((short)x)); \
61 #define SPLD_MACRO(ipl) SPLU_MACRO(ipl)
62 #define spln(x) splx(x)
66 #define ipltospl(ipl) (SR_SUPER | ((ipl) << 8))
69 * Define spls as the usual numbers (which should never be used
73 #define spl0() SPLD_MACRO(0)
74 #define spl1() SPLU_MACRO(1)
75 #define spl2() SPLU_MACRO(2)
76 #define spl3() SPLU_MACRO(3)
77 #define spl4() SPLU_MACRO(4)
78 #define spl5() SPLU_MACRO(5)
79 #define spl6() SPLU_MACRO(6)
80 #define spl7() SPLU_MACRO(7)
83 * Define spl mnemonics.
96 #define IPLSOFTCLOCK 1
98 #define splhigh() SPLU_MACRO(IPLHIGH)
99 #define splusclock() SPLU_MACRO(IPLUSCLOCK)
100 #define spldma() SPLU_MACRO(IPLDMA)
101 #define splscc() SPLU_MACRO(IPLSCC)
102 #define splclock() SPLU_MACRO(IPLCLOCK)
103 #define splbio() SPLU_MACRO(IPLBIO)
104 #define splsched() SPLU_MACRO(IPLSCHED)
105 #define splimp() SPLU_MACRO(IPLIMP)
106 #define splvm() SPLU_MACRO(IPLVM)
107 #define splnet() SPLU_MACRO(IPLNET)
108 #define spltty() SPLU_MACRO(IPLTTY)
109 #define splsoftclock() SPLU_MACRO(IPLSOFTCLOCK)
111 #endif _KERNSERV_M68K_SPL_H_