Commit | Line | Data |
---|---|---|
e637a509 WJ |
1 | /*- |
2 | * Copyright (c) 1989, 1990 William F. Jolitz. | |
3 | * Copyright (c) 1990 The Regents of the University of California. | |
4 | * All rights reserved. | |
5 | * | |
6 | * This code is derived from software contributed to Berkeley by | |
7 | * William Jolitz. | |
8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | |
17 | * 3. All advertising materials mentioning features or use of this software | |
18 | * must display the following acknowledgement: | |
19 | * This product includes software developed by the University of | |
20 | * California, Berkeley and its contributors. | |
21 | * 4. Neither the name of the University nor the names of its contributors | |
22 | * may be used to endorse or promote products derived from this software | |
23 | * without specific prior written permission. | |
24 | * | |
25 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
31 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
32 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
33 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
34 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
35 | * SUCH DAMAGE. | |
36 | * | |
37 | * @(#)icu.s 7.2 (Berkeley) 5/21/91 | |
38 | */ | |
39 | ||
40 | /* | |
41 | * AT/386 | |
42 | * Vector interrupt control section | |
43 | */ | |
44 | ||
45 | .data | |
46 | .globl _imen | |
47 | .globl _cpl | |
48 | _cpl: .long 0xffff # current priority level (all off) | |
49 | _imen: .long 0xffff # interrupt mask enable (all off) | |
50 | .globl _highmask | |
51 | _highmask: .long 0xffff | |
52 | .globl _ttymask | |
53 | _ttymask: .long 0 | |
54 | .globl _biomask | |
55 | _biomask: .long 0 | |
56 | .globl _netmask | |
57 | _netmask: .long 0 | |
58 | .globl _isa_intr | |
59 | _isa_intr: .space 16*4 | |
60 | ||
61 | .text | |
62 | /* | |
63 | * Handle return from interrupt after device handler finishes | |
64 | */ | |
65 | doreti: | |
66 | cli | |
67 | popl %ebx # remove intr number | |
68 | NOP | |
69 | popl %eax # get previous priority | |
70 | # now interrupt frame is a trap frame! | |
71 | movw %ax,%cx | |
72 | movw %ax,_cpl | |
73 | orw _imen,%ax | |
74 | outb %al,$ IO_ICU1+1 # re-enable intr? | |
75 | NOP | |
76 | movb %ah,%al | |
77 | outb %al,$ IO_ICU2+1 | |
78 | NOP | |
79 | ||
80 | cmpw $0x1f,13*4(%esp) # to user? | |
81 | je 1f # nope, leave | |
82 | andw $0xffff,%cx | |
83 | cmpw $0,%cx # returning to zero? | |
84 | je 1f | |
85 | ||
86 | pop %es # nope, going to non-zero level | |
87 | pop %ds | |
88 | popa | |
89 | addl $8,%esp | |
90 | iret | |
91 | ||
92 | 1: cmpl $0,_netisr # check for softint s/traps | |
93 | jne 1f | |
94 | cmpl $0,_want_resched | |
95 | jne 1f | |
96 | ||
97 | pop %es # none, going back to base pri | |
98 | pop %ds | |
99 | popa | |
100 | addl $8,%esp | |
101 | iret | |
102 | ||
103 | #include "../net/netisr.h" | |
104 | ||
105 | 1: | |
106 | ||
107 | #define DONET(s, c) ; \ | |
108 | .globl c ; \ | |
109 | btrl $ s ,_netisr ; \ | |
110 | jnb 1f ; \ | |
111 | call c ; \ | |
112 | 1: | |
113 | ||
114 | call _splnet | |
115 | ||
116 | DONET(NETISR_RAW,_rawintr) | |
117 | #ifdef INET | |
118 | DONET(NETISR_IP,_ipintr) | |
119 | #endif | |
120 | #ifdef IMP | |
121 | DONET(NETISR_IMP,_impintr) | |
122 | #endif | |
123 | #ifdef NS | |
124 | DONET(NETISR_NS,_nsintr) | |
125 | #endif | |
126 | ||
127 | #ifdef notdef | |
128 | NOP | |
129 | popl %eax | |
130 | movw %ax,_cpl | |
131 | orw _imen,%ax | |
132 | outb %al,$ IO_ICU1+1 # re-enable intr? | |
133 | NOP | |
134 | movb %ah,%al | |
135 | outb %al,$ IO_ICU2+1 | |
136 | NOP | |
137 | #else | |
138 | call _spl0 | |
139 | #endif | |
140 | ||
141 | btrl $ NETISR_SCLK,_netisr | |
142 | jnb 1f | |
143 | # back to an interrupt frame for a moment | |
144 | call _splsoftclock | |
145 | pushl $0xff # dummy intr | |
146 | call _softclock | |
147 | popl %eax | |
148 | call _spl0 | |
149 | ||
150 | # jmp 2f | |
151 | ||
152 | 1: | |
153 | cmpw $0x1f,13*4(%esp) # to user? | |
154 | jne 2f # nope, leave | |
155 | cmpl $0,_want_resched | |
156 | je 2f | |
157 | call _trap | |
158 | ||
159 | 2: pop %es | |
160 | pop %ds | |
161 | popal | |
162 | addl $8,%esp | |
163 | iret | |
164 | ||
165 | /* | |
166 | * Interrupt priority mechanism | |
167 | * | |
168 | * Two flavors -- imlXX masks relative to ISA noemenclature (for PC compat sw) | |
169 | * -- splXX masks with group mechanism for BSD purposes | |
170 | */ | |
171 | ||
172 | .globl _splhigh | |
173 | .globl _splclock | |
174 | _splhigh: | |
175 | _splclock: | |
176 | cli # disable interrupts | |
177 | NOP | |
178 | movw $0xffff,%ax # set new priority level | |
179 | movw %ax,%dx | |
180 | # orw _imen,%ax # mask off those not enabled yet | |
181 | movw %ax,%cx | |
182 | outb %al,$ IO_ICU1+1 /* update icu's */ | |
183 | NOP | |
184 | movb %ah,%al | |
185 | outb %al,$ IO_ICU2+1 | |
186 | NOP | |
187 | movzwl _cpl,%eax # return old priority | |
188 | movw %dx,_cpl # set new priority level | |
189 | sti # enable interrupts | |
190 | ret | |
191 | ||
192 | .globl _spltty # block clists | |
193 | _spltty: | |
194 | cli # disable interrupts | |
195 | NOP | |
196 | movw _cpl,%ax | |
197 | orw _ttymask,%ax | |
198 | movw %ax,%dx | |
199 | orw _imen,%ax # mask off those not enabled yet | |
200 | movw %ax,%cx | |
201 | outb %al,$ IO_ICU1+1 /* update icu's */ | |
202 | NOP | |
203 | movb %ah,%al | |
204 | outb %al,$ IO_ICU2+1 | |
205 | NOP | |
206 | movzwl _cpl,%eax # return old priority | |
207 | movw %dx,_cpl # set new priority level | |
208 | sti # enable interrupts | |
209 | ret | |
210 | ||
211 | .globl _splimp | |
212 | .globl _splnet | |
213 | _splimp: | |
214 | _splnet: | |
215 | cli # disable interrupts | |
216 | NOP | |
217 | movw _cpl,%ax | |
218 | orw _netmask,%ax | |
219 | movw %ax,%dx | |
220 | orw _imen,%ax # mask off those not enabled yet | |
221 | movw %ax,%cx | |
222 | outb %al,$ IO_ICU1+1 /* update icu's */ | |
223 | NOP | |
224 | movb %ah,%al | |
225 | outb %al,$ IO_ICU2+1 | |
226 | NOP | |
227 | movzwl _cpl,%eax # return old priority | |
228 | movw %dx,_cpl # set new priority level | |
229 | sti # enable interrupts | |
230 | ret | |
231 | ||
232 | .globl _splbio | |
233 | _splbio: | |
234 | cli # disable interrupts | |
235 | NOP | |
236 | movw _cpl,%ax | |
237 | orw _biomask,%ax | |
238 | movw %ax,%dx | |
239 | orw _imen,%ax # mask off those not enabled yet | |
240 | movw %ax,%cx | |
241 | outb %al,$ IO_ICU1+1 /* update icu's */ | |
242 | NOP | |
243 | movb %ah,%al | |
244 | outb %al,$ IO_ICU2+1 | |
245 | NOP | |
246 | movzwl _cpl,%eax # return old priority | |
247 | movw %dx,_cpl # set new priority level | |
248 | sti # enable interrupts | |
249 | ret | |
250 | ||
251 | .globl _splsoftclock | |
252 | _splsoftclock: | |
253 | cli # disable interrupts | |
254 | NOP | |
255 | movw _cpl,%ax | |
256 | orw $0x8000,%ax # set new priority level | |
257 | movw %ax,%dx | |
258 | orw _imen,%ax # mask off those not enabled yet | |
259 | movw %ax,%cx | |
260 | outb %al,$ IO_ICU1+1 /* update icu's */ | |
261 | NOP | |
262 | movb %ah,%al | |
263 | outb %al,$ IO_ICU2+1 | |
264 | NOP | |
265 | movzwl _cpl,%eax # return old priority | |
266 | movw %dx,_cpl # set new priority level | |
267 | sti # enable interrupts | |
268 | ret | |
269 | ||
270 | .globl _splnone | |
271 | .globl _spl0 | |
272 | _splnone: | |
273 | _spl0: | |
274 | cli # disable interrupts | |
275 | NOP | |
276 | pushl _cpl # save old priority | |
277 | movw _cpl,%ax | |
278 | orw _netmask,%ax # mask off those network devices | |
279 | movw %ax,_cpl # set new priority level | |
280 | orw _imen,%ax # mask off those not enabled yet | |
281 | outb %al,$ IO_ICU1+1 /* update icu's */ | |
282 | NOP | |
283 | movb %ah,%al | |
284 | outb %al,$ IO_ICU2+1 | |
285 | NOP | |
286 | sti # enable interrupts | |
287 | ||
288 | DONET(NETISR_RAW,_rawintr) | |
289 | #ifdef INET | |
290 | DONET(NETISR_IP,_ipintr) | |
291 | #endif | |
292 | cli # disable interrupts | |
293 | popl _cpl # save old priority | |
294 | NOP | |
295 | movw $0,%ax # set new priority level | |
296 | movw %ax,%dx | |
297 | orw _imen,%ax # mask off those not enabled yet | |
298 | movw %ax,%cx | |
299 | outb %al,$ IO_ICU1+1 /* update icu's */ | |
300 | NOP | |
301 | movb %ah,%al | |
302 | outb %al,$ IO_ICU2+1 | |
303 | NOP | |
304 | movzwl _cpl,%eax # return old priority | |
305 | movw %dx,_cpl # set new priority level | |
306 | sti # enable interrupts | |
307 | ret | |
308 | ||
309 | .globl _splx | |
310 | _splx: | |
311 | cli # disable interrupts | |
312 | NOP | |
313 | movw 4(%esp),%ax # new priority level | |
314 | movw %ax,%dx | |
315 | cmpw $0,%dx | |
316 | je _spl0 # going to "zero level" is special | |
317 | ||
318 | orw _imen,%ax # mask off those not enabled yet | |
319 | movw %ax,%cx | |
320 | outb %al,$ IO_ICU1+1 /* update icu's */ | |
321 | NOP | |
322 | movb %ah,%al | |
323 | outb %al,$ IO_ICU2+1 | |
324 | NOP | |
325 | movzwl _cpl,%eax # return old priority | |
326 | movw %dx,_cpl # set new priority level | |
327 | sti # enable interrupts | |
328 | ret | |
329 | ||
330 | /* hardware interrupt catcher (IDT 32 - 47) */ | |
331 | .globl _isa_strayintr | |
332 | ||
333 | IDTVEC(intr0) | |
334 | INTRSTRAY(0, _highmask, 0) ; call _isa_strayintr ; INTREXIT1 | |
335 | ||
336 | IDTVEC(intr1) | |
337 | INTRSTRAY(1, _highmask, 1) ; call _isa_strayintr ; INTREXIT1 | |
338 | ||
339 | IDTVEC(intr2) | |
340 | INTRSTRAY(2, _highmask, 2) ; call _isa_strayintr ; INTREXIT1 | |
341 | ||
342 | IDTVEC(intr3) | |
343 | INTRSTRAY(3, _highmask, 3) ; call _isa_strayintr ; INTREXIT1 | |
344 | ||
345 | IDTVEC(intr4) | |
346 | INTRSTRAY(4, _highmask, 4) ; call _isa_strayintr ; INTREXIT1 | |
347 | ||
348 | IDTVEC(intr5) | |
349 | INTRSTRAY(5, _highmask, 5) ; call _isa_strayintr ; INTREXIT1 | |
350 | ||
351 | IDTVEC(intr6) | |
352 | INTRSTRAY(6, _highmask, 6) ; call _isa_strayintr ; INTREXIT1 | |
353 | ||
354 | IDTVEC(intr7) | |
355 | INTRSTRAY(7, _highmask, 7) ; call _isa_strayintr ; INTREXIT1 | |
356 | ||
357 | ||
358 | IDTVEC(intr8) | |
359 | INTRSTRAY(8, _highmask, 8) ; call _isa_strayintr ; INTREXIT2 | |
360 | ||
361 | IDTVEC(intr9) | |
362 | INTRSTRAY(9, _highmask, 9) ; call _isa_strayintr ; INTREXIT2 | |
363 | ||
364 | IDTVEC(intr10) | |
365 | INTRSTRAY(10, _highmask, 10) ; call _isa_strayintr ; INTREXIT2 | |
366 | ||
367 | IDTVEC(intr11) | |
368 | INTRSTRAY(11, _highmask, 11) ; call _isa_strayintr ; INTREXIT2 | |
369 | ||
370 | IDTVEC(intr12) | |
371 | INTRSTRAY(12, _highmask, 12) ; call _isa_strayintr ; INTREXIT2 | |
372 | ||
373 | IDTVEC(intr13) | |
374 | INTRSTRAY(13, _highmask, 13) ; call _isa_strayintr ; INTREXIT2 | |
375 | ||
376 | IDTVEC(intr14) | |
377 | INTRSTRAY(14, _highmask, 14) ; call _isa_strayintr ; INTREXIT2 | |
378 | ||
379 | IDTVEC(intr15) | |
380 | INTRSTRAY(15, _highmask, 15) ; call _isa_strayintr ; INTREXIT2 | |
381 | ||
382 | IDTVEC(intrdefault) | |
383 | INTRSTRAY(255, _highmask, 255) ; call _isa_strayintr ; INTREXIT2 |