Changes in kernel/arch/ia32/src/interrupt.c [2a103b5:d19b3fc] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/src/interrupt.c
r2a103b5 rd19b3fc 39 39 #include <debug.h> 40 40 #include <panic.h> 41 #include <genarch/drivers/i8259/i8259.h> 42 #include <genarch/pic/pic_ops.h> 41 #include <arch/drivers/i8259.h> 43 42 #include <halt.h> 44 43 #include <cpu.h> … … 62 61 */ 63 62 64 pic_ops_t *pic_ops = NULL; 63 void (*disable_irqs_function)(uint16_t irqmask) = NULL; 64 void (*enable_irqs_function)(uint16_t irqmask) = NULL; 65 void (*eoi_function)(void) = NULL; 66 const char *irqs_info = NULL; 65 67 66 68 void istate_decode(istate_t *istate) … … 86 88 istate_from_uspace(istate) ? istate->esp : 87 89 (uint32_t) &istate->esp); 90 } 91 92 static void trap_virtual_eoi(void) 93 { 94 if (eoi_function) 95 eoi_function(); 96 else 97 panic("No eoi_function."); 98 88 99 } 89 100 … … 168 179 istate_t *istate __attribute__((unused))) 169 180 { 170 pic_ops->eoi(0);181 trap_virtual_eoi(); 171 182 tlb_shootdown_ipi_recv(); 172 183 } … … 181 192 bool ack = false; 182 193 assert(inum < IRQ_COUNT); 183 assert( inum != IRQ_PIC1);194 assert((inum != IRQ_PIC_SPUR) && (inum != IRQ_PIC1)); 184 195 185 196 irq_t *irq = irq_dispatch_and_lock(inum); … … 191 202 if (irq->preack) { 192 203 /* Send EOI before processing the interrupt */ 193 pic_ops->eoi(inum);204 trap_virtual_eoi(); 194 205 ack = true; 195 206 } … … 197 208 irq_spinlock_unlock(&irq->lock, false); 198 209 } else { 210 /* 211 * Spurious interrupt. 212 */ 199 213 #ifdef CONFIG_DEBUG 200 log(LF_ARCH, LVL_DEBUG, "cpu%u: unhandled IRQ %u", CPU->id, 201 inum); 214 printf("cpu%u: spurious interrupt (inum=%u)\n", CPU->id, inum); 202 215 #endif 203 216 } 204 217 205 218 if (!ack) 206 pic_ops->eoi(inum); 207 } 208 209 static void pic_spurious(unsigned int n, istate_t *istate) 210 { 211 unsigned int inum = n - IVT_IRQBASE; 212 if (!pic_ops->is_spurious(inum)) { 213 /* This is actually not a spurious IRQ, so proceed as usual. */ 214 irq_interrupt(n, istate); 215 return; 216 } 217 pic_ops->handle_spurious(n); 218 #ifdef CONFIG_DEBUG 219 log(LF_ARCH, LVL_DEBUG, "cpu%u: PIC spurious interrupt %u", CPU->id, 220 inum); 221 #endif 219 trap_virtual_eoi(); 222 220 } 223 221 … … 230 228 231 229 for (i = 0; i < IRQ_COUNT; i++) { 232 if ((i != IRQ_PIC0_SPUR) && (i != IRQ_PIC1_SPUR) && 233 (i != IRQ_PIC1)) 230 if ((i != IRQ_PIC_SPUR) && (i != IRQ_PIC1)) 234 231 exc_register(IVT_IRQBASE + i, "irq", true, 235 232 (iroutine_t) irq_interrupt); … … 242 239 exc_register(VECTOR_GP, "gp_fault", true, (iroutine_t) gp_fault); 243 240 exc_register(VECTOR_XM, "simd_fp", true, (iroutine_t) simd_fp_exception); 244 exc_register(VECTOR_PIC0_SPUR, "pic0_spurious", true,245 (iroutine_t) pic_spurious);246 exc_register(VECTOR_PIC1_SPUR, "pic1_spurious", true,247 (iroutine_t) pic_spurious);248 241 249 242 #ifdef CONFIG_SMP … … 253 246 } 254 247 248 void trap_virtual_enable_irqs(uint16_t irqmask) 249 { 250 if (enable_irqs_function) 251 enable_irqs_function(irqmask); 252 else 253 panic("No enable_irqs_function."); 254 } 255 256 void trap_virtual_disable_irqs(uint16_t irqmask) 257 { 258 if (disable_irqs_function) 259 disable_irqs_function(irqmask); 260 else 261 panic("No disable_irqs_function."); 262 } 263 255 264 /** @} 256 265 */
Note:
See TracChangeset
for help on using the changeset viewer.