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