Changeset ec04b20 in mainline for kernel/arch/ia32xen/src/interrupt.c
- Timestamp:
- 2006-10-27T13:56:25Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 410ed0d
- Parents:
- 8607db8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32xen/src/interrupt.c
r8607db8 rec04b20 51 51 #include <ipc/sysipc.h> 52 52 #include <interrupt.h> 53 #include <ddi/irq.h> 53 54 54 55 /* … … 60 61 void (* eoi_function)(void) = NULL; 61 62 62 void PRINT_INFO_ERRCODE(istate_t *istate)63 void decode_istate(istate_t *istate) 63 64 { 64 65 char *symbol = get_symtab_entry(istate->eip); … … 83 84 } 84 85 85 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) 86 96 { 87 97 fault_if_from_uspace(istate, "unserviced interrupt: %d", n); 88 98 89 PRINT_INFO_ERRCODE(istate);99 decode_istate(istate); 90 100 panic("unserviced interrupt: %d\n", n); 91 101 } 92 102 93 103 /** General Protection Fault. */ 94 void gp_fault(int n, istate_t *istate)104 static void gp_fault(int n, istate_t *istate) 95 105 { 96 106 if (TASK) { … … 115 125 } 116 126 117 PRINT_INFO_ERRCODE(istate);127 decode_istate(istate); 118 128 panic("general protection fault\n"); 119 129 } 120 130 121 void ss_fault(int n, istate_t *istate)131 static void ss_fault(int n, istate_t *istate) 122 132 { 123 133 fault_if_from_uspace(istate, "stack fault"); 124 134 125 PRINT_INFO_ERRCODE(istate);135 decode_istate(istate); 126 136 panic("stack fault\n"); 127 137 } 128 138 129 void simd_fp_exception(int n, istate_t *istate)139 static void simd_fp_exception(int n, istate_t *istate) 130 140 { 131 141 uint32_t mxcsr; … … 138 148 (unative_t)mxcsr); 139 149 140 PRINT_INFO_ERRCODE(istate);150 decode_istate(istate); 141 151 printf("MXCSR: %#zx\n",(unative_t)(mxcsr)); 142 152 panic("SIMD FP exception(19)\n"); 143 153 } 144 154 145 void nm_fault(int n, istate_t *istate)155 static void nm_fault(int n, istate_t *istate) 146 156 { 147 157 #ifdef CONFIG_FPU_LAZY … … 153 163 } 154 164 155 void syscall(int n, istate_t *istate) 156 { 157 panic("Obsolete syscall handler."); 158 } 159 160 void tlb_shootdown_ipi(int n, istate_t *istate) 165 #ifdef CONFIG_SMP 166 static void tlb_shootdown_ipi(int n, istate_t *istate) 161 167 { 162 168 trap_virtual_eoi(); 163 169 tlb_shootdown_ipi_recv(); 164 170 } 171 #endif 172 173 /** Handler of IRQ exceptions */ 174 static void irq_interrupt(int n, istate_t *istate) 175 { 176 ASSERT(n >= IVT_IRQBASE); 177 178 int inum = n - IVT_IRQBASE; 179 ASSERT(inum < IRQ_COUNT); 180 ASSERT((inum != IRQ_PIC_SPUR) && (inum != IRQ_PIC1)); 181 182 irq_t *irq = irq_dispatch_and_lock(inum); 183 if (irq) { 184 /* 185 * The IRQ handler was found. 186 */ 187 irq->handler(irq, irq->arg); 188 spinlock_unlock(&irq->lock); 189 } else { 190 /* 191 * Spurious interrupt. 192 */ 193 #ifdef CONFIG_DEBUG 194 printf("cpu%d: spurious interrupt (inum=%d)\n", CPU->id, inum); 195 #endif 196 } 197 trap_virtual_eoi(); 198 } 199 200 void interrupt_init(void) 201 { 202 int i; 203 204 for (i = 0; i < IVT_ITEMS; i++) 205 exc_register(i, "null", (iroutine) null_interrupt); 206 207 for (i = 0; i < IRQ_COUNT; i++) { 208 if ((i != IRQ_PIC_SPUR) && (i != IRQ_PIC1)) 209 exc_register(IVT_IRQBASE + i, "irq", (iroutine) irq_interrupt); 210 } 211 212 exc_register(7, "nm_fault", (iroutine) nm_fault); 213 exc_register(12, "ss_fault", (iroutine) ss_fault); 214 exc_register(13, "gp_fault", (iroutine) gp_fault); 215 exc_register(19, "simd_fp", (iroutine) simd_fp_exception); 216 217 #ifdef CONFIG_SMP 218 exc_register(VECTOR_TLB_SHOOTDOWN_IPI, "tlb_shootdown", (iroutine) tlb_shootdown_ipi); 219 #endif 220 } 165 221 166 222 void trap_virtual_enable_irqs(uint16_t irqmask) … … 180 236 } 181 237 182 void trap_virtual_eoi(void)183 {184 if (eoi_function)185 eoi_function();186 else187 panic("no eoi_function\n");188 189 }190 191 238 /** @} 192 239 */
Note:
See TracChangeset
for help on using the changeset viewer.