|
|
1.1 root 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: popl %eax # get previous priority
69: # now interrupt frame is a trap frame!
70: movw %ax,%cx
71: movw %ax,_cpl
72: orw _imen,%ax
73: NOP
74: outb %al,$ IO_ICU1+1 # re-enable intr?
75: NOP
76: movb %ah,%al
77: NOP
78: outb %al,$ IO_ICU2+1
79: NOP
80: inb $0x84,%al
81:
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:
95: pop %es # none, going back to base pri
96: pop %ds
97: popa
98: addl $8,%esp
99: iret
100:
101: #include "../net/netisr.h"
102:
103: 1:
104:
105: #define DONET(s, c) ; \
106: .globl c ; \
107: movl $ s ,%eax ; \
108: btrl %eax,_netisr ; \
109: jnb 1f ; \
110: call c ; \
111: 1:
112:
113: call _splnet
114: pushl %eax
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: popl %eax
128: movw %ax,_cpl
129: orw _imen,%ax
130: NOP
131: outb %al,$ IO_ICU1+1 # re-enable intr?
132: NOP
133: movb %ah,%al
134: NOP
135: outb %al,$ IO_ICU2+1
136: NOP
137: inb $0x84,%al
138:
139: # btrl $ NETISR_SCLK,_netisr
140: movl $ NETISR_SCLK,%eax # stupid assembler, as usual
141: btrl %eax,_netisr
142: jnb 1f
143: # back to an interrupt frame for a moment
144: call _splsoftclock
145: pushl %eax
146: pushl $0xff # dummy intr
147: call _softclock
148: popl %eax
149: call _splx
150: popl %eax
151:
152: jmp 2f
153:
154: /* 1: btrl $NETISR_AST,_netisr*/
155: 1:
156: cmpw $0x1f,13*4(%esp) # to user?
157: jne 2f # nope, leave
158: movl $ NETISR_AST,%eax # stupid assembler, as usual
159: btrl %eax,_netisr
160: jnb 2f
161: call _trap
162:
163: 2: pop %es
164: pop %ds
165: popal
166: addl $8,%esp
167: iret
168:
169: /*
170: * Interrupt priority mechanism
171: *
172: * Two flavors -- imlXX masks relative to ISA noemenclature (for PC compat sw)
173: * -- splXX masks with group mechanism for BSD purposes
174: */
175:
176: .globl _splhigh
177: .globl _splclock
178: _splhigh:
179: _splclock:
180: cli # disable interrupts
181: movw $0xffff,%ax # set new priority level
182: movw %ax,%dx
183: # orw _imen,%ax # mask off those not enabled yet
184: movw %ax,%cx
185: NOP
186: outb %al,$ IO_ICU1+1 /* update icu's */
187: NOP
188: movb %ah,%al
189: NOP
190: outb %al,$ IO_ICU2+1
191: NOP
192: inb $0x84,%al
193: movzwl _cpl,%eax # return old priority
194: movw %dx,_cpl # set new priority level
195: sti # enable interrupts
196: ret
197:
198: .globl _spltty # block clists
199: _spltty:
200: cli # disable interrupts
201: movw _cpl,%ax
202: orw _ttymask,%ax
203: movw %ax,%dx
204: orw _imen,%ax # mask off those not enabled yet
205: movw %ax,%cx
206: NOP
207: outb %al,$ IO_ICU1+1 /* update icu's */
208: NOP
209: movb %ah,%al
210: NOP
211: outb %al,$ IO_ICU2+1
212: NOP
213: inb $0x84,%al
214: movzwl _cpl,%eax # return old priority
215: movw %dx,_cpl # set new priority level
216: sti # enable interrupts
217: ret
218:
219: .globl _splimp
220: .globl _splnet
221: _splimp:
222: _splnet:
223: cli # disable interrupts
224: movw _cpl,%ax
225: orw _netmask,%ax
226: movw %ax,%dx
227: orw _imen,%ax # mask off those not enabled yet
228: movw %ax,%cx
229: NOP
230: outb %al,$ IO_ICU1+1 /* update icu's */
231: NOP
232: movb %ah,%al
233: NOP
234: outb %al,$ IO_ICU2+1
235: NOP
236: inb $0x84,%al
237: movzwl _cpl,%eax # return old priority
238: movw %dx,_cpl # set new priority level
239: sti # enable interrupts
240: ret
241:
242: .globl _splbio
243: _splbio:
244: cli # disable interrupts
245: movw _cpl,%ax
246: orw _biomask,%ax
247: movw %ax,%dx
248: orw _imen,%ax # mask off those not enabled yet
249: movw %ax,%cx
250: NOP
251: outb %al,$ IO_ICU1+1 /* update icu's */
252: NOP
253: movb %ah,%al
254: NOP
255: outb %al,$ IO_ICU2+1
256: NOP
257: inb $0x84,%al
258: movzwl _cpl,%eax # return old priority
259: movw %dx,_cpl # set new priority level
260: sti # enable interrupts
261: ret
262:
263: .globl _splsoftclock
264: _splsoftclock:
265: cli # disable interrupts
266: movw _cpl,%ax
267: orw $0x8000,%ax # set new priority level
268: movw %ax,%dx
269: orw _imen,%ax # mask off those not enabled yet
270: movw %ax,%cx
271: NOP
272: outb %al,$ IO_ICU1+1 /* update icu's */
273: NOP
274: movb %ah,%al
275: NOP
276: outb %al,$ IO_ICU2+1
277: NOP
278: inb $0x84,%al
279: movzwl _cpl,%eax # return old priority
280: movw %dx,_cpl # set new priority level
281: sti # enable interrupts
282: ret
283:
284: .globl _splnone
285: .globl _spl0
286: _splnone:
287: _spl0:
288: cli # disable interrupts
289: pushl _cpl # save old priority
290: movw _cpl,%ax
291: orw _netmask,%ax # mask off those network devices
292: movw %ax,_cpl # set new priority level
293: orw _imen,%ax # mask off those not enabled yet
294: NOP
295: outb %al,$ IO_ICU1+1 /* update icu's */
296: NOP
297: movb %ah,%al
298: NOP
299: outb %al,$ IO_ICU2+1
300: NOP
301: inb $0x84,%al
302: sti # enable interrupts
303:
304: DONET(NETISR_RAW,_rawintr)
305: #ifdef INET
306: DONET(NETISR_IP,_ipintr)
307: #endif
308: cli # disable interrupts
309: popl _cpl # save old priority
310: movw $0,%ax # set new priority level
311: movw %ax,%dx
312: orw _imen,%ax # mask off those not enabled yet
313: movw %ax,%cx
314: NOP
315: outb %al,$ IO_ICU1+1 /* update icu's */
316: NOP
317: movb %ah,%al
318: NOP
319: outb %al,$ IO_ICU2+1
320: NOP
321: inb $0x84,%al
322: movzwl _cpl,%eax # return old priority
323: movw %dx,_cpl # set new priority level
324: sti # enable interrupts
325: ret
326:
327: .globl _splx
328: _splx:
329: cli # disable interrupts
330: movw 4(%esp),%ax # new priority level
331: movw %ax,%dx
332: cmpw $0,%dx
333: je _spl0 # going to "zero level" is special
334:
335: orw _imen,%ax # mask off those not enabled yet
336: movw %ax,%cx
337: NOP
338: outb %al,$ IO_ICU1+1 /* update icu's */
339: NOP
340: movb %ah,%al
341: NOP
342: outb %al,$ IO_ICU2+1
343: NOP
344: inb $0x84,%al
345: movzwl _cpl,%eax # return old priority
346: movw %dx,_cpl # set new priority level
347: sti # enable interrupts
348: ret
349:
350: #ifdef notyet
351: .globl _iml8 # mask off all but irq0-1
352: _iml8:
353: cli # disable interrupts
354: movw $0xfffc,%ax # set new priority level
355: movw %ax,%dx
356: orw _imen,%ax # mask off those not enabled yet
357: movw %ax,%cx
358: NOP
359: outb %al,$ IO_ICU1+1 /* update icu's */
360: NOP
361: movb %ah,%al
362: NOP
363: outb %al,$ IO_ICU2+1
364: NOP
365: movzwl _cpl,%eax # return old priority
366: movw %dx,_cpl # set new priority level
367: sti # enable interrupts
368: ret
369:
370: .globl _iml10 # mask off all but irq0-1,8-9
371: _iml10:
372: cli # disable interrupts
373: movw $0xfcf8,%ax # set new priority level
374: movw %ax,%dx
375: orw _imen,%ax # mask off those not enabled yet
376: movw %ax,%cx
377: NOP
378: outb %al,$ IO_ICU1+1 /* update icu's */
379: NOP
380: movb %ah,%al
381: NOP
382: outb %al,$ IO_ICU2+1
383: NOP
384: movzwl _cpl,%eax # return old priority
385: movw %dx,_cpl # set new priority level
386: sti # enable interrupts
387: ret
388:
389: .globl _iml11 # mask off all but irq0-1,8-10
390: _iml11:
391: cli # disable interrupts
392: movw $0xf8f8,%ax # set new priority level
393: movw %ax,%dx
394: orw _imen,%ax # mask off those not enabled yet
395: movw %ax,%cx
396: NOP
397: outb %al,$ IO_ICU1+1 /* update icu's */
398: NOP
399: movb %ah,%al
400: NOP
401: outb %al,$ IO_ICU2+1
402: NOP
403: movzwl _cpl,%eax # return old priority
404: movw %dx,_cpl # set new priority level
405: sti # enable interrupts
406: ret
407:
408: .globl _iml12 # mask off all but irq0-1,8-11
409: _iml12:
410: cli # disable interrupts
411: movw $0xf0f8,%ax # set new priority level
412: movw %ax,%dx
413: orw _imen,%ax # mask off those not enabled yet
414: movw %ax,%cx
415: NOP
416: outb %al,$ IO_ICU1+1 /* update icu's */
417: NOP
418: movb %ah,%al
419: NOP
420: outb %al,$ IO_ICU2+1
421: NOP
422: movzwl _cpl,%eax # return old priority
423: movw %dx,_cpl # set new priority level
424: sti # enable interrupts
425: ret
426:
427: .globl _iml13 # mask off all but irq0-1,8-12
428: _iml13:
429: cli # disable interrupts
430: movw $0xe0f8,%ax # set new priority level
431: movw %ax,%dx
432: orw _imen,%ax # mask off those not enabled yet
433: movw %ax,%cx
434: NOP
435: outb %al,$ IO_ICU1+1 /* update icu's */
436: NOP
437: movb %ah,%al
438: NOP
439: outb %al,$ IO_ICU2+1
440: NOP
441: movzwl _cpl,%eax # return old priority
442: movw %dx,_cpl # set new priority level
443: sti # enable interrupts
444: ret
445:
446: .globl _iml15 # mask off all but irq0-1,8-14
447: _iml15:
448: cli # disable interrupts
449: movw $0x80f8,%ax # set new priority level
450: movw %ax,%dx
451: orw _imen,%ax # mask off those not enabled yet
452: movw %ax,%cx
453: NOP
454: outb %al,$ IO_ICU1+1 /* update icu's */
455: NOP
456: movb %ah,%al
457: NOP
458: outb %al,$ IO_ICU2+1
459: NOP
460: movzwl _cpl,%eax # return old priority
461: movw %dx,_cpl # set new priority level
462: sti # enable interrupts
463: ret
464:
465: .globl _iml3 # mask off all but irq0-1,8-15
466: _iml3:
467: cli # disable interrupts
468: movw $0x00f8,%ax # set new priority level
469: movw %ax,%dx
470: orw _imen,%ax # mask off those not enabled yet
471: movw %ax,%cx
472: NOP
473: outb %al,$ IO_ICU1+1 /* update icu's */
474: NOP
475: movb %ah,%al
476: NOP
477: outb %al,$ IO_ICU2+1
478: NOP
479: movzwl _cpl,%eax # return old priority
480: movw %dx,_cpl # set new priority level
481: sti # enable interrupts
482: ret
483:
484: .globl _iml4 # mask off all but irq0-1,8-15,3
485: _iml4:
486: cli # disable interrupts
487: movw $0x00f0,%ax # set new priority level
488: movw %ax,%dx
489: orw _imen,%ax # mask off those not enabled yet
490: movw %ax,%cx
491: NOP
492: outb %al,$ IO_ICU1+1 /* update icu's */
493: NOP
494: movb %ah,%al
495: NOP
496: outb %al,$ IO_ICU2+1
497: NOP
498: movzwl _cpl,%eax # return old priority
499: movw %dx,_cpl # set new priority level
500: sti # enable interrupts
501: ret
502:
503: .globl _iml5 # mask off all but irq0-1,8-15,3-4
504: _iml5:
505: cli # disable interrupts
506: movw $0x00e0,%ax # set new priority level
507: movw %ax,%dx
508: orw _imen,%ax # mask off those not enabled yet
509: movw %ax,%cx
510: NOP
511: outb %al,$ IO_ICU1+1 /* update icu's */
512: NOP
513: movb %ah,%al
514: NOP
515: outb %al,$ IO_ICU2+1
516: NOP
517: movzwl _cpl,%eax # return old priority
518: movw %dx,_cpl # set new priority level
519: sti # enable interrupts
520: ret
521:
522: .globl _iml6 # mask off all but irq0-1,8-15,3-5
523: _iml6:
524: cli # disable interrupts
525: movw $0x00c0,%ax # set new priority level
526: movw %ax,%dx
527: orw _imen,%ax # mask off those not enabled yet
528: movw %ax,%cx
529: NOP
530: outb %al,$ IO_ICU1+1 /* update icu's */
531: NOP
532: movb %ah,%al
533: NOP
534: outb %al,$ IO_ICU2+1
535: NOP
536: movzwl _cpl,%eax # return old priority
537: movw %dx,_cpl # set new priority level
538: sti # enable interrupts
539: ret
540:
541: #endif notyet
542:
543: /* hardware interrupt catcher (IDT 32 - 47) */
544: .globl _isa_strayintr
545:
546: IDTVEC(intr0)
547: INTR(0, _highmask, 0) ; call _isa_strayintr ; INTREXIT1
548:
549: IDTVEC(intr1)
550: INTR(1, _highmask, 1) ; call _isa_strayintr ; INTREXIT1
551:
552: IDTVEC(intr2)
553: INTR(2, _highmask, 2) ; call _isa_strayintr ; INTREXIT1
554:
555: IDTVEC(intr3)
556: INTR(3, _highmask, 3) ; call _isa_strayintr ; INTREXIT1
557:
558: IDTVEC(intr4)
559: INTR(4, _highmask, 4) ; call _isa_strayintr ; INTREXIT1
560:
561: IDTVEC(intr5)
562: INTR(5, _highmask, 5) ; call _isa_strayintr ; INTREXIT1
563:
564: IDTVEC(intr6)
565: INTR(6, _highmask, 6) ; call _isa_strayintr ; INTREXIT1
566:
567: IDTVEC(intr7)
568: INTR(7, _highmask, 7) ; call _isa_strayintr ; INTREXIT1
569:
570:
571: IDTVEC(intr8)
572: INTR(8, _highmask, 8) ; call _isa_strayintr ; INTREXIT2
573:
574: IDTVEC(intr9)
575: INTR(9, _highmask, 9) ; call _isa_strayintr ; INTREXIT2
576:
577: IDTVEC(intr10)
578: INTR(10, _highmask, 10) ; call _isa_strayintr ; INTREXIT2
579:
580: IDTVEC(intr11)
581: INTR(11, _highmask, 11) ; call _isa_strayintr ; INTREXIT2
582:
583: IDTVEC(intr12)
584: INTR(12, _highmask, 12) ; call _isa_strayintr ; INTREXIT2
585:
586: IDTVEC(intr13)
587: INTR(13, _highmask, 13) ; call _isa_strayintr ; INTREXIT2
588:
589: IDTVEC(intr14)
590: INTR(14, _highmask, 14) ; call _isa_strayintr ; INTREXIT2
591:
592: IDTVEC(intr15)
593: INTR(15, _highmask, 15) ; call _isa_strayintr ; INTREXIT2
594:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.