alpha -> beta
[mpls-ppp.git] / NeXT / spl.h
blob120f48059407f6ce7f5d93e9f620439bcec6d2fb
1 /*
2 * File: spl.h
3 * Author: Avadis Tevanian, Jr.
5 * Define inline macros for spl routines.
6 *
7 * HISTORY
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_
20 #ifdef KERNEL_BUILD
21 #import <iplmeas.h>
22 #else KERNEL_BUILD
23 /* #import <mach/features.h> */
24 #endif KERNEL_BUILD
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)
32 #ifndef SPLU_MACRO
34 #ifdef ASSEMBLER
35 #define SPLU_MACRO(ipl) \
36 movw sr,d0; \
37 movw \#((ipl)*256 + 0x2000),sr;
39 #define splx(nsr) \
40 movw sr,d0; \
41 movw nsr,sr;
43 #else ASSEMBLER
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)); \
49 ret; \
52 #define splx(x) \
53 ({ register short ret; \
54 asm volatile ("movw sr,%0" : "=dm" (ret)); \
55 asm volatile ("movw %1,sr" : "=m" (*(char *)0): "Jdm" ((short)x)); \
56 ret; \
59 #endif ASSEMBLER
61 #define SPLD_MACRO(ipl) SPLU_MACRO(ipl)
62 #define spln(x) splx(x)
64 #endif SPLU_MACRO
66 #define ipltospl(ipl) (SR_SUPER | ((ipl) << 8))
69 * Define spls as the usual numbers (which should never be used
70 * directly.
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.
85 #define IPLHIGH 7
86 #define IPLDMA 6
87 #define IPLUSCLOCK 6
88 #define IPLSCC 5
89 #define IPLCLOCK 3
90 #define IPLBIO 3
91 #define IPLSCHED 3
92 #define IPLIMP 3
93 #define IPLVM 3
94 #define IPLNET 2
95 #define IPLTTY 1
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_