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