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 | |
6d829b69 FM |
38 | * |
39 | * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE | |
40 | * -------------------- ----- ---------------------- | |
6b9305fd | 41 | * CURRENT PATCH LEVEL: 2 00117 |
6d829b69 FM |
42 | * -------------------- ----- ---------------------- |
43 | * | |
44 | * 28 Nov 92 Frank MacLachlan Aligned addresses and data | |
45 | * on 32bit boundaries. | |
6b9305fd PS |
46 | * 24 Mar 93 Rodney W. Grimes Added interrupt counters for vmstat |
47 | * also stray and false intr counters added | |
e637a509 WJ |
48 | */ |
49 | ||
50 | /* | |
51 | * AT/386 | |
52 | * Vector interrupt control section | |
53 | */ | |
54 | ||
55 | .data | |
6d829b69 | 56 | ALIGN32 |
e637a509 WJ |
57 | .globl _imen |
58 | .globl _cpl | |
59 | _cpl: .long 0xffff # current priority level (all off) | |
60 | _imen: .long 0xffff # interrupt mask enable (all off) | |
61 | .globl _highmask | |
62 | _highmask: .long 0xffff | |
63 | .globl _ttymask | |
64 | _ttymask: .long 0 | |
65 | .globl _biomask | |
66 | _biomask: .long 0 | |
67 | .globl _netmask | |
68 | _netmask: .long 0 | |
69 | .globl _isa_intr | |
6b9305fd PS |
70 | /* |
71 | * This is the names of the counters for vmstat added by | |
72 | * rgrimes@agora.rain.com (Rodney W. Grimes) 10/30/1992 | |
73 | * Added false and stray counters 3/25/1993 rgrimes | |
74 | */ | |
75 | .globl _intrcnt, _eintrcnt /* Added to make vmstat happy */ | |
76 | .globl _isa_false7_intrcnt, _isa_false15_intrcnt, _isa_stray_intrcnt | |
77 | _intrcnt: /* Added to make vmstat happy */ | |
78 | _isa_false7_intrcnt: | |
79 | .space 4 /* false IRQ7's */ | |
80 | _isa_false15_intrcnt: | |
81 | .space 4 /* false IRQ15's */ | |
82 | _isa_stray_intrcnt: | |
83 | .space 4 /* stray interrupts */ | |
e637a509 | 84 | _isa_intr: .space 16*4 |
6b9305fd | 85 | _eintrcnt: /* Added to make vmstat happy */ |
e637a509 WJ |
86 | |
87 | .text | |
88 | /* | |
89 | * Handle return from interrupt after device handler finishes | |
90 | */ | |
6d829b69 | 91 | ALIGN32 |
e637a509 WJ |
92 | doreti: |
93 | cli | |
94 | popl %ebx # remove intr number | |
95 | NOP | |
96 | popl %eax # get previous priority | |
97 | # now interrupt frame is a trap frame! | |
98 | movw %ax,%cx | |
99 | movw %ax,_cpl | |
100 | orw _imen,%ax | |
101 | outb %al,$ IO_ICU1+1 # re-enable intr? | |
102 | NOP | |
103 | movb %ah,%al | |
104 | outb %al,$ IO_ICU2+1 | |
105 | NOP | |
106 | ||
107 | cmpw $0x1f,13*4(%esp) # to user? | |
108 | je 1f # nope, leave | |
109 | andw $0xffff,%cx | |
110 | cmpw $0,%cx # returning to zero? | |
111 | je 1f | |
112 | ||
113 | pop %es # nope, going to non-zero level | |
114 | pop %ds | |
115 | popa | |
116 | addl $8,%esp | |
117 | iret | |
118 | ||
6d829b69 | 119 | ALIGN32 |
e637a509 WJ |
120 | 1: cmpl $0,_netisr # check for softint s/traps |
121 | jne 1f | |
122 | cmpl $0,_want_resched | |
123 | jne 1f | |
124 | ||
125 | pop %es # none, going back to base pri | |
126 | pop %ds | |
127 | popa | |
128 | addl $8,%esp | |
129 | iret | |
130 | ||
131 | #include "../net/netisr.h" | |
132 | ||
6d829b69 | 133 | ALIGN32 |
e637a509 WJ |
134 | 1: |
135 | ||
136 | #define DONET(s, c) ; \ | |
137 | .globl c ; \ | |
138 | btrl $ s ,_netisr ; \ | |
139 | jnb 1f ; \ | |
140 | call c ; \ | |
141 | 1: | |
142 | ||
143 | call _splnet | |
144 | ||
145 | DONET(NETISR_RAW,_rawintr) | |
146 | #ifdef INET | |
147 | DONET(NETISR_IP,_ipintr) | |
148 | #endif | |
149 | #ifdef IMP | |
150 | DONET(NETISR_IMP,_impintr) | |
151 | #endif | |
152 | #ifdef NS | |
153 | DONET(NETISR_NS,_nsintr) | |
154 | #endif | |
155 | ||
156 | #ifdef notdef | |
157 | NOP | |
158 | popl %eax | |
159 | movw %ax,_cpl | |
160 | orw _imen,%ax | |
161 | outb %al,$ IO_ICU1+1 # re-enable intr? | |
162 | NOP | |
163 | movb %ah,%al | |
164 | outb %al,$ IO_ICU2+1 | |
165 | NOP | |
166 | #else | |
167 | call _spl0 | |
168 | #endif | |
169 | ||
170 | btrl $ NETISR_SCLK,_netisr | |
171 | jnb 1f | |
172 | # back to an interrupt frame for a moment | |
173 | call _splsoftclock | |
174 | pushl $0xff # dummy intr | |
175 | call _softclock | |
176 | popl %eax | |
177 | call _spl0 | |
178 | ||
179 | # jmp 2f | |
180 | ||
181 | 1: | |
182 | cmpw $0x1f,13*4(%esp) # to user? | |
183 | jne 2f # nope, leave | |
184 | cmpl $0,_want_resched | |
185 | je 2f | |
186 | call _trap | |
187 | ||
188 | 2: pop %es | |
189 | pop %ds | |
190 | popal | |
191 | addl $8,%esp | |
192 | iret | |
193 | ||
194 | /* | |
195 | * Interrupt priority mechanism | |
196 | * | |
197 | * Two flavors -- imlXX masks relative to ISA noemenclature (for PC compat sw) | |
198 | * -- splXX masks with group mechanism for BSD purposes | |
199 | */ | |
200 | ||
201 | .globl _splhigh | |
202 | .globl _splclock | |
6d829b69 | 203 | ALIGN32 |
e637a509 WJ |
204 | _splhigh: |
205 | _splclock: | |
206 | cli # disable interrupts | |
207 | NOP | |
208 | movw $0xffff,%ax # set new priority level | |
209 | movw %ax,%dx | |
210 | # orw _imen,%ax # mask off those not enabled yet | |
211 | movw %ax,%cx | |
212 | outb %al,$ IO_ICU1+1 /* update icu's */ | |
213 | NOP | |
214 | movb %ah,%al | |
215 | outb %al,$ IO_ICU2+1 | |
216 | NOP | |
217 | movzwl _cpl,%eax # return old priority | |
218 | movw %dx,_cpl # set new priority level | |
219 | sti # enable interrupts | |
220 | ret | |
221 | ||
222 | .globl _spltty # block clists | |
6d829b69 | 223 | ALIGN32 |
e637a509 WJ |
224 | _spltty: |
225 | cli # disable interrupts | |
226 | NOP | |
227 | movw _cpl,%ax | |
228 | orw _ttymask,%ax | |
229 | movw %ax,%dx | |
230 | orw _imen,%ax # mask off those not enabled yet | |
231 | movw %ax,%cx | |
232 | outb %al,$ IO_ICU1+1 /* update icu's */ | |
233 | NOP | |
234 | movb %ah,%al | |
235 | outb %al,$ IO_ICU2+1 | |
236 | NOP | |
237 | movzwl _cpl,%eax # return old priority | |
238 | movw %dx,_cpl # set new priority level | |
239 | sti # enable interrupts | |
240 | ret | |
241 | ||
242 | .globl _splimp | |
243 | .globl _splnet | |
6d829b69 | 244 | ALIGN32 |
e637a509 WJ |
245 | _splimp: |
246 | _splnet: | |
247 | cli # disable interrupts | |
248 | NOP | |
249 | movw _cpl,%ax | |
250 | orw _netmask,%ax | |
251 | movw %ax,%dx | |
252 | orw _imen,%ax # mask off those not enabled yet | |
253 | movw %ax,%cx | |
254 | outb %al,$ IO_ICU1+1 /* update icu's */ | |
255 | NOP | |
256 | movb %ah,%al | |
257 | outb %al,$ IO_ICU2+1 | |
258 | NOP | |
259 | movzwl _cpl,%eax # return old priority | |
260 | movw %dx,_cpl # set new priority level | |
261 | sti # enable interrupts | |
262 | ret | |
263 | ||
264 | .globl _splbio | |
6d829b69 | 265 | ALIGN32 |
e637a509 WJ |
266 | _splbio: |
267 | cli # disable interrupts | |
268 | NOP | |
269 | movw _cpl,%ax | |
270 | orw _biomask,%ax | |
271 | movw %ax,%dx | |
272 | orw _imen,%ax # mask off those not enabled yet | |
273 | movw %ax,%cx | |
274 | outb %al,$ IO_ICU1+1 /* update icu's */ | |
275 | NOP | |
276 | movb %ah,%al | |
277 | outb %al,$ IO_ICU2+1 | |
278 | NOP | |
279 | movzwl _cpl,%eax # return old priority | |
280 | movw %dx,_cpl # set new priority level | |
281 | sti # enable interrupts | |
282 | ret | |
283 | ||
284 | .globl _splsoftclock | |
6d829b69 | 285 | ALIGN32 |
e637a509 WJ |
286 | _splsoftclock: |
287 | cli # disable interrupts | |
288 | NOP | |
289 | movw _cpl,%ax | |
290 | orw $0x8000,%ax # set new priority level | |
291 | movw %ax,%dx | |
292 | orw _imen,%ax # mask off those not enabled yet | |
293 | movw %ax,%cx | |
294 | outb %al,$ IO_ICU1+1 /* update icu's */ | |
295 | NOP | |
296 | movb %ah,%al | |
297 | outb %al,$ IO_ICU2+1 | |
298 | NOP | |
299 | movzwl _cpl,%eax # return old priority | |
300 | movw %dx,_cpl # set new priority level | |
301 | sti # enable interrupts | |
302 | ret | |
303 | ||
304 | .globl _splnone | |
305 | .globl _spl0 | |
6d829b69 | 306 | ALIGN32 |
e637a509 WJ |
307 | _splnone: |
308 | _spl0: | |
309 | cli # disable interrupts | |
310 | NOP | |
311 | pushl _cpl # save old priority | |
312 | movw _cpl,%ax | |
313 | orw _netmask,%ax # mask off those network devices | |
314 | movw %ax,_cpl # set new priority level | |
315 | orw _imen,%ax # mask off those not enabled yet | |
316 | outb %al,$ IO_ICU1+1 /* update icu's */ | |
317 | NOP | |
318 | movb %ah,%al | |
319 | outb %al,$ IO_ICU2+1 | |
320 | NOP | |
321 | sti # enable interrupts | |
322 | ||
323 | DONET(NETISR_RAW,_rawintr) | |
324 | #ifdef INET | |
325 | DONET(NETISR_IP,_ipintr) | |
326 | #endif | |
327 | cli # disable interrupts | |
328 | popl _cpl # save old priority | |
329 | NOP | |
330 | movw $0,%ax # set new priority level | |
331 | movw %ax,%dx | |
332 | orw _imen,%ax # mask off those not enabled yet | |
333 | movw %ax,%cx | |
334 | outb %al,$ IO_ICU1+1 /* update icu's */ | |
335 | NOP | |
336 | movb %ah,%al | |
337 | outb %al,$ IO_ICU2+1 | |
338 | NOP | |
339 | movzwl _cpl,%eax # return old priority | |
340 | movw %dx,_cpl # set new priority level | |
341 | sti # enable interrupts | |
342 | ret | |
343 | ||
344 | .globl _splx | |
6d829b69 | 345 | ALIGN32 |
e637a509 WJ |
346 | _splx: |
347 | cli # disable interrupts | |
348 | NOP | |
349 | movw 4(%esp),%ax # new priority level | |
350 | movw %ax,%dx | |
351 | cmpw $0,%dx | |
352 | je _spl0 # going to "zero level" is special | |
353 | ||
354 | orw _imen,%ax # mask off those not enabled yet | |
355 | movw %ax,%cx | |
356 | outb %al,$ IO_ICU1+1 /* update icu's */ | |
357 | NOP | |
358 | movb %ah,%al | |
359 | outb %al,$ IO_ICU2+1 | |
360 | NOP | |
361 | movzwl _cpl,%eax # return old priority | |
362 | movw %dx,_cpl # set new priority level | |
363 | sti # enable interrupts | |
364 | ret | |
365 | ||
366 | /* hardware interrupt catcher (IDT 32 - 47) */ | |
367 | .globl _isa_strayintr | |
368 | ||
369 | IDTVEC(intr0) | |
370 | INTRSTRAY(0, _highmask, 0) ; call _isa_strayintr ; INTREXIT1 | |
371 | ||
372 | IDTVEC(intr1) | |
373 | INTRSTRAY(1, _highmask, 1) ; call _isa_strayintr ; INTREXIT1 | |
374 | ||
375 | IDTVEC(intr2) | |
376 | INTRSTRAY(2, _highmask, 2) ; call _isa_strayintr ; INTREXIT1 | |
377 | ||
378 | IDTVEC(intr3) | |
379 | INTRSTRAY(3, _highmask, 3) ; call _isa_strayintr ; INTREXIT1 | |
380 | ||
381 | IDTVEC(intr4) | |
382 | INTRSTRAY(4, _highmask, 4) ; call _isa_strayintr ; INTREXIT1 | |
383 | ||
384 | IDTVEC(intr5) | |
385 | INTRSTRAY(5, _highmask, 5) ; call _isa_strayintr ; INTREXIT1 | |
386 | ||
387 | IDTVEC(intr6) | |
388 | INTRSTRAY(6, _highmask, 6) ; call _isa_strayintr ; INTREXIT1 | |
389 | ||
390 | IDTVEC(intr7) | |
391 | INTRSTRAY(7, _highmask, 7) ; call _isa_strayintr ; INTREXIT1 | |
392 | ||
393 | ||
394 | IDTVEC(intr8) | |
395 | INTRSTRAY(8, _highmask, 8) ; call _isa_strayintr ; INTREXIT2 | |
396 | ||
397 | IDTVEC(intr9) | |
398 | INTRSTRAY(9, _highmask, 9) ; call _isa_strayintr ; INTREXIT2 | |
399 | ||
400 | IDTVEC(intr10) | |
401 | INTRSTRAY(10, _highmask, 10) ; call _isa_strayintr ; INTREXIT2 | |
402 | ||
403 | IDTVEC(intr11) | |
404 | INTRSTRAY(11, _highmask, 11) ; call _isa_strayintr ; INTREXIT2 | |
405 | ||
406 | IDTVEC(intr12) | |
407 | INTRSTRAY(12, _highmask, 12) ; call _isa_strayintr ; INTREXIT2 | |
408 | ||
409 | IDTVEC(intr13) | |
410 | INTRSTRAY(13, _highmask, 13) ; call _isa_strayintr ; INTREXIT2 | |
411 | ||
412 | IDTVEC(intr14) | |
413 | INTRSTRAY(14, _highmask, 14) ; call _isa_strayintr ; INTREXIT2 | |
414 | ||
415 | IDTVEC(intr15) | |
416 | INTRSTRAY(15, _highmask, 15) ; call _isa_strayintr ; INTREXIT2 | |
417 | ||
418 | IDTVEC(intrdefault) | |
419 | INTRSTRAY(255, _highmask, 255) ; call _isa_strayintr ; INTREXIT2 |