Changeset 8607db8 in mainline for kernel/arch/amd64/src/interrupt.c
- Timestamp:
- 2006-10-27T13:34:20Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ec04b20
- Parents:
- 16d71f41
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/src/interrupt.c
r16d71f41 r8607db8 52 52 #include <arch/ddi/ddi.h> 53 53 #include <interrupt.h> 54 #include <ipc/irq.h> 55 56 void print_info_errcode(int n, istate_t *istate) 54 #include <ddi/irq.h> 55 56 /* 57 * Interrupt and exception dispatching. 58 */ 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 64 void decode_istate(int n, istate_t *istate) 57 65 { 58 66 char *symbol; … … 76 84 } 77 85 78 /* 79 * Interrupt and exception dispatching. 80 */ 81 82 void (* disable_irqs_function)(uint16_t irqmask) = NULL; 83 void (* enable_irqs_function)(uint16_t irqmask) = NULL; 84 void (* eoi_function)(void) = NULL; 85 86 void null_interrupt(int n, istate_t *istate) 86 static void trap_virtual_eoi(void) 87 { 88 if (eoi_function) 89 eoi_function(); 90 else 91 panic("no eoi_function\n"); 92 93 } 94 95 static void null_interrupt(int n, istate_t *istate) 87 96 { 88 97 fault_if_from_uspace(istate, "unserviced interrupt: %d", n); 89 print_info_errcode(n, istate);98 decode_istate(n, istate); 90 99 panic("unserviced interrupt\n"); 91 100 } 92 101 93 102 /** General Protection Fault. */ 94 void gp_fault(int n, istate_t *istate)103 static void gp_fault(int n, istate_t *istate) 95 104 { 96 105 if (TASK) { … … 115 124 } 116 125 117 print_info_errcode(n, istate);126 decode_istate(n, istate); 118 127 panic("general protection fault\n"); 119 128 } 120 129 121 void ss_fault(int n, istate_t *istate)130 static void ss_fault(int n, istate_t *istate) 122 131 { 123 132 fault_if_from_uspace(istate, "stack fault"); 124 print_info_errcode(n, istate);133 decode_istate(n, istate); 125 134 panic("stack fault\n"); 126 135 } 127 136 128 void nm_fault(int n, istate_t *istate)137 static void nm_fault(int n, istate_t *istate) 129 138 { 130 139 #ifdef CONFIG_FPU_LAZY … … 136 145 } 137 146 138 void tlb_shootdown_ipi(int n, istate_t *istate)147 static void tlb_shootdown_ipi(int n, istate_t *istate) 139 148 { 140 149 trap_virtual_eoi(); 141 150 tlb_shootdown_ipi_recv(); 151 } 152 153 /** Handler of IRQ exceptions */ 154 static void irq_interrupt(int n, istate_t *istate) 155 { 156 ASSERT(n >= IVT_IRQBASE); 157 158 int inum = n - IVT_IRQBASE; 159 ASSERT(inum < IRQ_COUNT); 160 ASSERT((inum != IRQ_PIC_SPUR) && (inum != IRQ_PIC1)); 161 162 irq_t *irq = irq_dispatch_and_lock(inum); 163 if (irq) { 164 /* 165 * The IRQ handler was found. 166 */ 167 irq->handler(irq, irq->arg); 168 spinlock_unlock(&irq->lock); 169 } else { 170 /* 171 * Spurious interrupt. 172 */ 173 #ifdef CONFIG_DEBUG 174 printf("cpu%d: spurious interrupt (inum=%d)\n", CPU->id, inum); 175 #endif 176 } 177 trap_virtual_eoi(); 178 } 179 180 void interrupt_init(void) 181 { 182 int i; 183 184 for (i = 0; i < IVT_ITEMS; i++) 185 exc_register(i, "null", (iroutine) null_interrupt); 186 187 for (i = 0; i < IRQ_COUNT; i++) { 188 if ((i != IRQ_PIC_SPUR) && (i != IRQ_PIC1)) 189 exc_register(IVT_IRQBASE + i, "irq", (iroutine) irq_interrupt); 190 } 191 192 exc_register(7, "nm_fault", (iroutine) nm_fault); 193 exc_register(12, "ss_fault", (iroutine) ss_fault); 194 exc_register(13, "gp_fault", (iroutine) gp_fault); 195 exc_register(14, "ident_mapper", (iroutine) ident_page_fault); 196 197 #ifdef CONFIG_SMP 198 exc_register(VECTOR_TLB_SHOOTDOWN_IPI, "tlb_shootdown", (iroutine) tlb_shootdown_ipi); 199 #endif 142 200 } 143 201 … … 158 216 } 159 217 160 void trap_virtual_eoi(void)161 {162 if (eoi_function)163 eoi_function();164 else165 panic("no eoi_function\n");166 167 }168 169 218 /** @} 170 219 */
Note:
See TracChangeset
for help on using the changeset viewer.