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