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 <machine/i8259.h>
34 #include <dev/isa/isareg.h>
35
36 #define MY_COUNT _C_LABEL(uvmexp)
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60 .globl _C_LABEL(isa_strayintr)
61
62 #ifdef MULTIPROCESSOR
63 #define LOCK_KERNEL(ipl) pushl ipl; call _C_LABEL(i386_intlock); addl $4,%esp
64 #define UNLOCK_KERNEL(ipl) pushl ipl; call _C_LABEL(i386_intunlock); addl $4,%esp
65 #else
66 #define LOCK_KERNEL(ipl)
67 #define UNLOCK_KERNEL(ipl)
68 #endif
69
70 #define voidop(num)
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88 #define INTRSTUB(name, num, early_ack, late_ack, mask, unmask, level_mask) \
89 IDTVEC(resume_namenum) ;\
90 push %ebx ;\
91 cli ;\
92 jmp 1f ;\
93 IDTVEC(recurse_namenum) ;\
94 pushfl ;\
95 pushl %cs ;\
96 pushl %esi ;\
97 pushl $0 ;\
98 pushl $T_ASTFLT ;\
99 movl %ebx,%esi ;\
100 INTRENTRY ;\
101 MAKE_FRAME ;\
102 push %esi ;\
103 cli ;\
104 jmp 1f ;\
105 _C_LABEL(Xintr_namenum): ;\
106 pushl $0 ;\
107 pushl $T_ASTFLT ;\
108 INTRENTRY ;\
109 MAKE_FRAME ;\
110 mask(num) ;\
111 early_ack(num) ;\
112 incl MY_COUNT+V_INTR ;\
113 movl _C_LABEL(iminlevel) + (num) * 4, %eax ;\
114 movl CPL,%ebx ;\
115 cmpl %eax,%ebx ;\
116 jae _C_LABEL(Xhold_namenum);\
117 pushl %ebx ;\
118 1: ;\
119 movl _C_LABEL(imaxlevel) + (num) * 4,%eax ;\
120 movl %eax,CPL ;\
121 sti ;\
122 movl _C_LABEL(intrhand) + (num) * 4,%ebx ;\
123 testl %ebx,%ebx ;\
124 jz _C_LABEL(Xstray_namenum) ;\
125 STRAY_INITIALIZE ;\
126 LOCK_KERNEL(IF_PPL(%esp)) ;\
127 7: movl IH_ARG(%ebx),%eax ;\
128 testl %eax,%eax ;\
129 jnz 4f ;\
130 movl %esp,%eax ;\
131 4: pushl %eax ;\
132 call *IH_FUN(%ebx) ;\
133 addl $4,%esp ;\
134 STRAY_INTEGRATE ;\
135 orl %eax,%eax ;\
136 jz 5f ;\
137 addl $1,IH_COUNT(%ebx) ;\
138 adcl $0,IH_COUNT+4(%ebx) ;\
139 5: movl IH_NEXT(%ebx),%ebx ;\
140 testl %ebx,%ebx ;\
141 jnz 7b ;\
142 UNLOCK_KERNEL(IF_PPL(%esp)) ;\
143 STRAY_TEST(name,num) ;\
144 6: unmask(num) ;\
145 late_ack(num) ;\
146 jmp _C_LABEL(Xdoreti) ;\
147 IDTVEC(stray_namenum) ;\
148 pushl $num ;\
149 call _C_LABEL(isa_strayintr) ;\
150 addl $4,%esp ;\
151 jmp 6b ;\
152 IDTVEC(hold_namenum) ;\
153 orb $IRQ_BIT(num),_C_LABEL(ipending) + IRQ_BYTE(num) ;\
154 INTRFASTEXIT
155
156 #if defined(DEBUG)
157 #define STRAY_INITIALIZE \
158 xorl %esi,%esi
159 #define STRAY_INTEGRATE \
160 orl %eax,%esi
161 #define STRAY_TEST(name,num) \
162 testl %esi,%esi ;\
163 jz _C_LABEL(Xstray_namenum)
164 #else
165 #define STRAY_INITIALIZE
166 #define STRAY_INTEGRATE
167 #define STRAY_TEST(name,num)
168 #endif
169
170 #ifdef DDB
171 #define MAKE_FRAME \
172 leal -8(%esp),%ebp
173 #else
174 #define MAKE_FRAME
175 #endif
176
177 #define ICUADDR IO_ICU1
178
179 INTRSTUB(legacy,0, i8259_asm_ack1, voidop, i8259_asm_mask, i8259_asm_unmask,
180 voidop)
181 INTRSTUB(legacy,1, i8259_asm_ack1, voidop, i8259_asm_mask, i8259_asm_unmask,
182 voidop)
183 INTRSTUB(legacy,2, i8259_asm_ack1, voidop, i8259_asm_mask, i8259_asm_unmask,
184 voidop)
185 INTRSTUB(legacy,3, i8259_asm_ack1, voidop, i8259_asm_mask, i8259_asm_unmask,
186 voidop)
187 INTRSTUB(legacy,4, i8259_asm_ack1, voidop, i8259_asm_mask, i8259_asm_unmask,
188 voidop)
189 INTRSTUB(legacy,5, i8259_asm_ack1, voidop, i8259_asm_mask, i8259_asm_unmask,
190 voidop)
191 INTRSTUB(legacy,6, i8259_asm_ack1, voidop, i8259_asm_mask, i8259_asm_unmask,
192 voidop)
193 INTRSTUB(legacy,7, i8259_asm_ack1, voidop, i8259_asm_mask, i8259_asm_unmask,
194 voidop)
195
196 #undef ICUADDR
197 #define ICUADDR IO_ICU2
198
199 INTRSTUB(legacy,8, i8259_asm_ack2, voidop, i8259_asm_mask, i8259_asm_unmask,
200 voidop)
201 INTRSTUB(legacy,9, i8259_asm_ack2, voidop, i8259_asm_mask, i8259_asm_unmask,
202 voidop)
203 INTRSTUB(legacy,10, i8259_asm_ack2, voidop, i8259_asm_mask, i8259_asm_unmask,
204 voidop)
205 INTRSTUB(legacy,11, i8259_asm_ack2, voidop, i8259_asm_mask, i8259_asm_unmask,
206 voidop)
207 INTRSTUB(legacy,12, i8259_asm_ack2, voidop, i8259_asm_mask, i8259_asm_unmask,
208 voidop)
209 INTRSTUB(legacy,13, i8259_asm_ack2, voidop, i8259_asm_mask, i8259_asm_unmask,
210 voidop)
211 INTRSTUB(legacy,14, i8259_asm_ack2, voidop, i8259_asm_mask, i8259_asm_unmask,
212 voidop)
213 INTRSTUB(legacy,15, i8259_asm_ack2, voidop, i8259_asm_mask, i8259_asm_unmask,
214 voidop)
215
216
217
218
219
220 IDTVEC(intr)
221 .long _C_LABEL(Xintr_legacy0), _C_LABEL(Xintr_legacy1)
222 .long _C_LABEL(Xintr_legacy2), _C_LABEL(Xintr_legacy3)
223 .long _C_LABEL(Xintr_legacy4), _C_LABEL(Xintr_legacy5)
224 .long _C_LABEL(Xintr_legacy6), _C_LABEL(Xintr_legacy7)
225 .long _C_LABEL(Xintr_legacy8), _C_LABEL(Xintr_legacy9)
226 .long _C_LABEL(Xintr_legacy10), _C_LABEL(Xintr_legacy11)
227 .long _C_LABEL(Xintr_legacy12), _C_LABEL(Xintr_legacy13)
228 .long _C_LABEL(Xintr_legacy14), _C_LABEL(Xintr_legacy15)
229
230
231
232
233
234 IDTVEC(resume)
235 .long _C_LABEL(Xresume_legacy0), _C_LABEL(Xresume_legacy1)
236 .long _C_LABEL(Xresume_legacy2), _C_LABEL(Xresume_legacy3)
237 .long _C_LABEL(Xresume_legacy4), _C_LABEL(Xresume_legacy5)
238 .long _C_LABEL(Xresume_legacy6), _C_LABEL(Xresume_legacy7)
239 .long _C_LABEL(Xresume_legacy8), _C_LABEL(Xresume_legacy9)
240 .long _C_LABEL(Xresume_legacy10), _C_LABEL(Xresume_legacy11)
241 .long _C_LABEL(Xresume_legacy12), _C_LABEL(Xresume_legacy13)
242 .long _C_LABEL(Xresume_legacy14), _C_LABEL(Xresume_legacy15)
243
244 .long 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
245 .long _C_LABEL(Xsoftast), _C_LABEL(Xsofttty)
246 .long _C_LABEL(Xsoftnet), _C_LABEL(Xsoftclock)
247 .long 0, 0
248
249 IDTVEC(recurse)
250 .long _C_LABEL(Xrecurse_legacy0), _C_LABEL(Xrecurse_legacy1)
251 .long _C_LABEL(Xrecurse_legacy2), _C_LABEL(Xrecurse_legacy3)
252 .long _C_LABEL(Xrecurse_legacy4), _C_LABEL(Xrecurse_legacy5)
253 .long _C_LABEL(Xrecurse_legacy6), _C_LABEL(Xrecurse_legacy7)
254 .long _C_LABEL(Xrecurse_legacy8), _C_LABEL(Xrecurse_legacy9)
255 .long _C_LABEL(Xrecurse_legacy10), _C_LABEL(Xrecurse_legacy11)
256 .long _C_LABEL(Xrecurse_legacy12), _C_LABEL(Xrecurse_legacy13)
257 .long _C_LABEL(Xrecurse_legacy14), _C_LABEL(Xrecurse_legacy15)
258
259 .long 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
260 .long _C_LABEL(Xsoftast), _C_LABEL(Xsofttty)
261 .long _C_LABEL(Xsoftnet), _C_LABEL(Xsoftclock)
262 .long 0, 0