blob: 708b63887e8be28323fec46e2fae32531f587c9a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
/* $OpenBSD: psl.h,v 1.5 1996/05/02 07:33:43 niklas Exp $ */
/* $NetBSD: psl.h,v 1.8 1996/04/21 21:13:22 veego Exp $ */
#ifndef _MACHINE_PSL_H_
#define _MACHINE_PSL_H_
#include <m68k/psl.h>
#if defined(_KERNEL) && !defined(_LOCORE)
static __inline int
splraise(npsl)
register int npsl;
{
register int opsl;
__asm __volatile ("clrl %0; movew sr,%0; movew %1,sr" : "&=d" (opsl) :
"di" (npsl));
return opsl;
}
#ifdef IPL_REMAP_1
extern int isr_exter_ipl;
extern void walk_ipls __P((int, int));
static __inline int
splx(npsl)
register int npsl;
{
register int opsl;
__asm __volatile ("clrl %0; movew sr,%0" : "=d" (opsl));
if ((isr_exter_ipl << 8) > (npsl & PSL_IPL))
walk_ipls(isr_exter_ipl, npsl);
__asm __volatile("movew %0,sr" : : "di" (npsl));
return opsl;
}
#endif
#ifndef IPL_REMAP_2
#define splx splraise
#else
extern int walk_ipls __P((int));
static __inline int
splx(npsl)
register int npsl;
{
register int opsl;
/* We should maybe have a flag telling if this is needed. */
opsl = walk_ipls(npsl);
__asm __volatile("movew %0,sr" : : "di" (npsl));
return opsl;
}
#endif
/*
* Shortcuts
*/
#define spl1() splraise(PSL_S|PSL_IPL1)
#define spl2() splraise(PSL_S|PSL_IPL2)
#define spl3() splraise(PSL_S|PSL_IPL3)
#define spl4() splraise(PSL_S|PSL_IPL4)
#define spl5() splraise(PSL_S|PSL_IPL5)
#define spl6() splraise(PSL_S|PSL_IPL6)
#define spl7() splraise(PSL_S|PSL_IPL7)
/*
* Hardware interrupt masks
*/
#define splbio() spl3()
#define splnet() spl3()
#define spltty() spl4()
#define splimp() spl4()
#if defined(LEV6_DEFER) || defined(IPL_REMAP_1) || defined(IPL_REMAP_2)
#define splclock() spl4()
#else
#define splclock() spl6()
#endif
#define splstatclock() splclock()
/*
* Software interrupt masks
*
* NOTE: splsoftclock() is used by hardclock() to lower the priority from
* clock to softclock before it calls softclock().
*/
#define splsoftclock() splx(PSL_S|PSL_IPL1)
#define splsoftnet() spl1()
#define splsofttty() spl1()
/*
* Miscellaneous
*/
#if defined(LEV6_DEFER) || defined(IPL_REMAP_1) || defined(IPL_REMAP_2)
#define splhigh() spl4()
#else
#define splhigh() spl7()
#endif
#define spl0() splx(PSL_S|PSL_IPL0)
#endif /* KERNEL && !_LOCORE */
#endif /* _MACHINE_PSL_H_ */
|