Changes in kernel/arch/amd64/src/interrupt.c [d19b3fc:2a103b5] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/src/interrupt.c
rd19b3fc r2a103b5 37 37 #include <log.h> 38 38 #include <panic.h> 39 #include <arch/drivers/i8259.h> 39 #include <genarch/drivers/i8259/i8259.h> 40 #include <genarch/pic/pic_ops.h> 40 41 #include <halt.h> 41 42 #include <cpu.h> … … 57 58 * Interrupt and exception dispatching. 58 59 */ 59 60 void (*disable_irqs_function)(uint16_t irqmask) = NULL; 61 void (*enable_irqs_function)(uint16_t irqmask) = NULL; 62 void (*eoi_function)(void) = NULL; 63 const char *irqs_info = NULL; 60 pic_ops_t *pic_ops = NULL; 64 61 65 62 void istate_decode(istate_t *istate) … … 89 86 "r14=%0#18" PRIx64 "\tr15=%0#18" PRIx64 "\n", 90 87 istate->r12, istate->r13, istate->r14, istate->r15); 91 }92 93 static void trap_virtual_eoi(void)94 {95 if (eoi_function)96 eoi_function();97 else98 panic("No eoi_function.");99 100 88 } 101 89 … … 157 145 static void tlb_shootdown_ipi(unsigned int n, istate_t *istate) 158 146 { 159 trap_virtual_eoi();147 pic_ops->eoi(0); 160 148 tlb_shootdown_ipi_recv(); 161 149 } … … 172 160 bool ack = false; 173 161 assert(inum < IRQ_COUNT); 174 assert( (inum != IRQ_PIC_SPUR) && (inum != IRQ_PIC1));162 assert(inum != IRQ_PIC1); 175 163 176 164 irq_t *irq = irq_dispatch_and_lock(inum); … … 182 170 if (irq->preack) { 183 171 /* Send EOI before processing the interrupt */ 184 trap_virtual_eoi();172 pic_ops->eoi(inum); 185 173 ack = true; 186 174 } … … 188 176 irq_spinlock_unlock(&irq->lock, false); 189 177 } else { 190 /*191 * Spurious interrupt.192 */193 178 #ifdef CONFIG_DEBUG 194 log(LF_ARCH, LVL_DEBUG, "cpu%u: spurious interrupt (inum=%u)",195 CPU->id,inum);179 log(LF_ARCH, LVL_DEBUG, "cpu%u: unhandled IRQ %u", CPU->id, 180 inum); 196 181 #endif 197 182 } 198 183 199 184 if (!ack) 200 trap_virtual_eoi(); 185 pic_ops->eoi(inum); 186 } 187 188 static void pic_spurious(unsigned int n, istate_t *istate) 189 { 190 unsigned int inum = n - IVT_IRQBASE; 191 if (!pic_ops->is_spurious(inum)) { 192 /* This is actually not a spurious IRQ, so proceed as usual. */ 193 irq_interrupt(n, istate); 194 return; 195 } 196 pic_ops->handle_spurious(n); 197 #ifdef CONFIG_DEBUG 198 log(LF_ARCH, LVL_DEBUG, "cpu%u: PIC spurious interrupt %u", CPU->id, 199 inum); 200 #endif 201 201 } 202 202 … … 209 209 210 210 for (i = 0; i < IRQ_COUNT; i++) { 211 if ((i != IRQ_PIC_SPUR) && (i != IRQ_PIC1)) 211 if ((i != IRQ_PIC0_SPUR) && (i != IRQ_PIC1_SPUR) && 212 (i != IRQ_PIC1)) 212 213 exc_register(IVT_IRQBASE + i, "irq", true, 213 214 (iroutine_t) irq_interrupt); … … 218 219 exc_register(VECTOR_SS, "ss_fault", true, (iroutine_t) ss_fault); 219 220 exc_register(VECTOR_GP, "gp_fault", true, (iroutine_t) gp_fault); 221 exc_register(VECTOR_PIC0_SPUR, "pic0_spurious", true, 222 (iroutine_t) pic_spurious); 223 exc_register(VECTOR_PIC1_SPUR, "pic1_spurious", true, 224 (iroutine_t) pic_spurious); 220 225 221 226 #ifdef CONFIG_SMP … … 225 230 } 226 231 227 void trap_virtual_enable_irqs(uint16_t irqmask)228 {229 if (enable_irqs_function)230 enable_irqs_function(irqmask);231 else232 panic("No enable_irqs_function.");233 }234 235 void trap_virtual_disable_irqs(uint16_t irqmask)236 {237 if (disable_irqs_function)238 disable_irqs_function(irqmask);239 else240 panic("No disable_irqs_function.");241 }242 243 232 /** @} 244 233 */
Note:
See TracChangeset
for help on using the changeset viewer.