Changes in kernel/arch/amd64/src/interrupt.c [304342e:9171f12] in mainline
- File:
-
- 1 edited
-
kernel/arch/amd64/src/interrupt.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/src/interrupt.c
r304342e r9171f12 63 63 void (* eoi_function)(void) = NULL; 64 64 65 void decode_istate(int n, istate_t *istate) 66 { 67 char *symbol; 68 69 symbol = symtab_fmt_name_lookup(istate->rip); 70 71 printf("-----EXCEPTION(%d) OCCURED----- ( %s )\n", n, __func__); 72 printf("%%rip: %#llx (%s)\n", istate->rip, symbol); 73 printf("ERROR_WORD=%#llx\n", istate->error_word); 74 printf("%%cs=%#llx, rflags=%#llx, %%cr0=%#llx\n", istate->cs, 75 istate->rflags, read_cr0()); 76 printf("%%rax=%#llx, %%rcx=%#llx, %%rdx=%#llx\n", istate->rax, 77 istate->rcx, istate->rdx); 78 printf("%%rsi=%#llx, %%rdi=%#llx, %%r8=%#llx\n", istate->rsi, 79 istate->rdi, istate->r8); 80 printf("%%r9=%#llx, %%r10=%#llx, %%r11=%#llx\n", istate->r9, 81 istate->r10, istate->r11); 82 printf("%%rsp=%#llx\n", &istate->stack[0]); 83 84 stack_trace_istate(istate); 65 void istate_decode(istate_t *istate) 66 { 67 printf("cs =%p\trip=%p\trfl=%p\terr=%p\n", 68 istate->cs, istate->rip, istate->rflags, istate->error_word); 69 70 if (istate_from_uspace(istate)) 71 printf("ss =%p\n", istate->ss); 72 73 printf("rax=%p\trbx=%p\trcx=%p\trdx=%p\n", 74 istate->rax, istate->rbx, istate->rcx, istate->rdx); 75 printf("rsi=%p\trdi=%p\trbp=%p\trsp=%p\n", 76 istate->rsi, istate->rdi, istate->rbp, 77 istate_from_uspace(istate) ? istate->rsp : (uintptr_t)&istate->rsp); 78 printf("r8 =%p\tr9 =%p\tr10=%p\tr11=%p\n", 79 istate->r8, istate->r9, istate->r10, istate->r11); 80 printf("r12=%p\tr13=%p\tr14=%p\tr15=%p\n", 81 istate->r12, istate->r13, istate->r14, istate->r15); 85 82 } 86 83 … … 94 91 } 95 92 96 static void null_interrupt(int n, istate_t *istate) 97 { 98 fault_if_from_uspace(istate, "Unserviced interrupt: %d.", n); 99 decode_istate(n, istate); 100 panic("Unserviced interrupt."); 101 } 102 103 static void de_fault(int n, istate_t *istate) 93 static void null_interrupt(unsigned int n, istate_t *istate) 94 { 95 fault_if_from_uspace(istate, "Unserviced interrupt: %u.", n); 96 panic_badtrap(istate, n, "Unserviced interrupt."); 97 } 98 99 static void de_fault(unsigned int n, istate_t *istate) 104 100 { 105 101 fault_if_from_uspace(istate, "Divide error."); 106 decode_istate(n, istate); 107 panic("Divide error."); 108 } 109 110 /** General Protection Fault. */ 111 static void gp_fault(int n, istate_t *istate) 102 panic_badtrap(istate, n, "Divide error."); 103 } 104 105 /** General Protection Fault. 106 * 107 */ 108 static void gp_fault(unsigned int n, istate_t *istate) 112 109 { 113 110 if (TASK) { 114 size_t ver; 115 116 spinlock_lock(&TASK->lock); 117 ver = TASK->arch.iomapver; 118 spinlock_unlock(&TASK->lock); 119 111 irq_spinlock_lock(&TASK->lock, false); 112 size_t ver = TASK->arch.iomapver; 113 irq_spinlock_unlock(&TASK->lock, false); 114 120 115 if (CPU->arch.iomapver_copy != ver) { 121 116 /* … … 131 126 fault_if_from_uspace(istate, "General protection fault."); 132 127 } 133 134 decode_istate(n, istate); 135 panic("General protection fault."); 136 } 137 138 static void ss_fault(int n, istate_t *istate) 128 panic_badtrap(istate, n, "General protection fault."); 129 } 130 131 static void ss_fault(unsigned int n, istate_t *istate) 139 132 { 140 133 fault_if_from_uspace(istate, "Stack fault."); 141 decode_istate(n, istate); 142 panic("Stack fault."); 143 } 144 145 static void nm_fault(int n, istate_t *istate) 134 panic_badtrap(istate, n, "Stack fault."); 135 } 136 137 static void nm_fault(unsigned int n, istate_t *istate) 146 138 { 147 139 #ifdef CONFIG_FPU_LAZY … … 154 146 155 147 #ifdef CONFIG_SMP 156 static void tlb_shootdown_ipi( int n, istate_t *istate)148 static void tlb_shootdown_ipi(unsigned int n, istate_t *istate) 157 149 { 158 150 trap_virtual_eoi(); … … 161 153 #endif 162 154 163 /** Handler of IRQ exceptions */ 164 static void irq_interrupt(int n, istate_t *istate) 155 /** Handler of IRQ exceptions. 156 * 157 */ 158 static void irq_interrupt(unsigned int n, istate_t *istate) 165 159 { 166 160 ASSERT(n >= IVT_IRQBASE); 167 161 168 int inum = n - IVT_IRQBASE;162 unsigned int inum = n - IVT_IRQBASE; 169 163 bool ack = false; 170 164 ASSERT(inum < IRQ_COUNT); … … 176 170 * The IRQ handler was found. 177 171 */ 178 172 179 173 if (irq->preack) { 180 174 /* Send EOI before processing the interrupt */ … … 183 177 } 184 178 irq->handler(irq); 185 spinlock_unlock(&irq->lock);179 irq_spinlock_unlock(&irq->lock, false); 186 180 } else { 187 181 /* … … 189 183 */ 190 184 #ifdef CONFIG_DEBUG 191 printf("cpu% d: spurious interrupt (inum=%d)\n", CPU->id, inum);185 printf("cpu%u: spurious interrupt (inum=%u)\n", CPU->id, inum); 192 186 #endif 193 187 } … … 199 193 void interrupt_init(void) 200 194 { 201 int i;195 unsigned int i; 202 196 203 197 for (i = 0; i < IVT_ITEMS; i++) 204 exc_register(i, "null", (iroutine) null_interrupt);198 exc_register(i, "null", false, (iroutine_t) null_interrupt); 205 199 206 200 for (i = 0; i < IRQ_COUNT; i++) { 207 201 if ((i != IRQ_PIC_SPUR) && (i != IRQ_PIC1)) 208 exc_register(IVT_IRQBASE + i, "irq", 209 (iroutine ) irq_interrupt);202 exc_register(IVT_IRQBASE + i, "irq", true, 203 (iroutine_t) irq_interrupt); 210 204 } 211 205 212 exc_register(0, "de_fault", (iroutine) de_fault); 213 exc_register(7, "nm_fault", (iroutine) nm_fault); 214 exc_register(12, "ss_fault", (iroutine) ss_fault); 215 exc_register(13, "gp_fault", (iroutine) gp_fault); 216 exc_register(14, "ident_mapper", (iroutine) ident_page_fault); 206 exc_register(0, "de_fault", true, (iroutine_t) de_fault); 207 exc_register(7, "nm_fault", true, (iroutine_t) nm_fault); 208 exc_register(12, "ss_fault", true, (iroutine_t) ss_fault); 209 exc_register(13, "gp_fault", true, (iroutine_t) gp_fault); 217 210 218 211 #ifdef CONFIG_SMP 219 exc_register(VECTOR_TLB_SHOOTDOWN_IPI, "tlb_shootdown", 220 (iroutine ) tlb_shootdown_ipi);212 exc_register(VECTOR_TLB_SHOOTDOWN_IPI, "tlb_shootdown", true, 213 (iroutine_t) tlb_shootdown_ipi); 221 214 #endif 222 215 }
Note:
See TracChangeset
for help on using the changeset viewer.
