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 #include <net/netisr.h>
34
35 .data
36 .globl _C_LABEL(imen),_C_LABEL(ipending),_C_LABEL(netisr)
37 _C_LABEL(imen):
38 .long 0xffff # interrupt mask enable (all off)
39 _C_LABEL(ipending):
40 .long 0 # interrupts pending
41 _C_LABEL(netisr):
42 .long 0 # scheduling bits for network
43
44 .text
45
46
47
48
49
50
51
52
53 IDTVEC(spllower)
54 pushl %ebx
55 pushl %esi
56 pushl %edi
57 movl CPL,%ebx # save priority
58 movl $1f,%esi # address to resume loop at
59 1: movl %ebx,%eax # get cpl
60 shrl $4,%eax # find its mask.
61 movl _C_LABEL(iunmask)(,%eax,4),%eax
62 cli
63 andl _C_LABEL(ipending),%eax # any non-masked bits left?
64 jz 2f
65 sti
66 bsfl %eax,%eax
67 btrl %eax,_C_LABEL(ipending)
68 jnc 1b
69 jmp *_C_LABEL(Xrecurse)(,%eax,4)
70 2: movl %ebx,CPL
71 sti
72 popl %edi
73 popl %esi
74 popl %ebx
75 ret
76
77
78
79
80
81
82
83
84
85 IDTVEC(doreti)
86 popl %ebx # get previous priority
87 movl $1f,%esi # address to resume loop at
88 1: movl %ebx,%eax
89 shrl $4,%eax
90 movl _C_LABEL(iunmask)(,%eax,4),%eax
91 cli
92 andl _C_LABEL(ipending),%eax
93 jz 2f
94 sti
95 bsfl %eax,%eax # slow, but not worth optimizing
96 btrl %eax,_C_LABEL(ipending)
97 jnc 1b # some intr cleared the in-memory bit
98 cli
99 jmp *_C_LABEL(Xresume)(,%eax,4)
100 2:
101 CHECK_ASTPENDING(%ecx)
102 movl %ebx,CPL
103 je 3f
104 testb $SEL_RPL,TF_CS(%esp)
105 #ifdef VM86
106 jnz 4f
107 testl $PSL_VM,TF_EFLAGS(%esp)
108 #endif
109 jz 3f
110 4: CLEAR_ASTPENDING(%ecx)
111 sti
112 movl $T_ASTFLT,TF_TRAPNO(%esp)
113
114 call _C_LABEL(trap)
115 cli
116 jmp 2b
117 3: INTRFASTEXIT
118
119
120
121
122
123
124 #include "pccom.h"
125
126 IDTVEC(softast)
127 movl $IPL_SOFTAST,%eax
128 movl %eax,CPL
129 sti
130 jmp *%esi
131
132 IDTVEC(softtty)
133 #if NPCCOM > 0
134 movl $IPL_SOFTTTY,%eax
135 movl %eax,CPL
136 sti
137 #ifdef MULTIPROCESSOR
138 call _C_LABEL(i386_softintlock)
139 #endif
140 call _C_LABEL(comsoft)
141 #ifdef MULTIPROCESSOR
142 call _C_LABEL(i386_softintunlock)
143 #endif
144 #endif
145 jmp *%esi
146
147 #define DONETISR(s, c) \
148 .globl _C_LABEL(c) ;\
149 testl $(1 << s),%edi ;\
150 jz 1f ;\
151 call _C_LABEL(c) ;\
152 1:
153
154 IDTVEC(softnet)
155 movl $IPL_SOFTNET,%eax
156 movl %eax,CPL
157 sti
158 #ifdef MULTIPROCESSOR
159 call _C_LABEL(i386_softintlock)
160 #endif
161 xorl %edi,%edi
162 xchgl _C_LABEL(netisr),%edi
163 #include <net/netisr_dispatch.h>
164 #ifdef MULTIPROCESSOR
165 call _C_LABEL(i386_softintunlock)
166 #endif
167 jmp *%esi
168 #undef DONETISR
169
170 IDTVEC(softclock)
171 movl $IPL_SOFTCLOCK,%eax
172 movl %eax,CPL
173 sti
174 #ifdef MULTIPROCESSOR
175 call _C_LABEL(i386_softintlock)
176 #endif
177 call _C_LABEL(softclock)
178 #ifdef MULTIPROCESSOR
179 call _C_LABEL(i386_softintunlock)
180 #endif
181 jmp *%esi
182