Rev 3022 | Rev 4156 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3022 | Rev 4055 | ||
|---|---|---|---|
| Line 78... | Line 78... | ||
| 78 | istate->rcx, istate->rdx); |
78 | istate->rcx, istate->rdx); |
| 79 | printf("%%rsi=%#llx, %%rdi=%#llx, %%r8=%#llx\n", istate->rsi, |
79 | printf("%%rsi=%#llx, %%rdi=%#llx, %%r8=%#llx\n", istate->rsi, |
| 80 | istate->rdi, istate->r8); |
80 | istate->rdi, istate->r8); |
| 81 | printf("%%r9=%#llx, %%r10=%#llx, %%r11=%#llx\n", istate->r9, |
81 | printf("%%r9=%#llx, %%r10=%#llx, %%r11=%#llx\n", istate->r9, |
| 82 | istate->r10, istate->r11); |
82 | istate->r10, istate->r11); |
| 83 | #ifdef CONFIG_DEBUG_ALLREGS |
- | |
| 84 | printf("%%r12=%#llx, %%r13=%#llx, %%r14=%#llx\n", istate->r12, |
- | |
| 85 | istate->r13, istate->r14); |
- | |
| 86 | printf("%%r15=%#llx, %%rbx=%#llx, %%rbp=%#llx\n", istate->r15, |
- | |
| 87 | istate->rbx, &istate->rbp); |
- | |
| 88 | #endif |
- | |
| 89 | printf("%%rsp=%#llx\n", &istate->stack[0]); |
83 | printf("%%rsp=%#llx\n", &istate->stack[0]); |
| 90 | } |
84 | } |
| 91 | 85 | ||
| 92 | static void trap_virtual_eoi(void) |
86 | static void trap_virtual_eoi(void) |
| 93 | { |
87 | { |
| 94 | if (eoi_function) |
88 | if (eoi_function) |
| 95 | eoi_function(); |
89 | eoi_function(); |
| 96 | else |
90 | else |
| 97 | panic("no eoi_function\n"); |
91 | panic("No eoi_function."); |
| 98 | 92 | ||
| 99 | } |
93 | } |
| 100 | 94 | ||
| 101 | static void null_interrupt(int n, istate_t *istate) |
95 | static void null_interrupt(int n, istate_t *istate) |
| 102 | { |
96 | { |
| 103 | fault_if_from_uspace(istate, "unserviced interrupt: %d", n); |
97 | fault_if_from_uspace(istate, "Unserviced interrupt: %d.", n); |
| 104 | decode_istate(n, istate); |
98 | decode_istate(n, istate); |
| 105 | panic("unserviced interrupt\n"); |
99 | panic("Unserviced interrupt."); |
| 106 | } |
100 | } |
| 107 | 101 | ||
| 108 | /** General Protection Fault. */ |
102 | /** General Protection Fault. */ |
| 109 | static void gp_fault(int n, istate_t *istate) |
103 | static void gp_fault(int n, istate_t *istate) |
| 110 | { |
104 | { |
| Line 124... | Line 118... | ||
| 124 | * the instruction. |
118 | * the instruction. |
| 125 | */ |
119 | */ |
| 126 | io_perm_bitmap_install(); |
120 | io_perm_bitmap_install(); |
| 127 | return; |
121 | return; |
| 128 | } |
122 | } |
| 129 | fault_if_from_uspace(istate, "general protection fault"); |
123 | fault_if_from_uspace(istate, "General protection fault."); |
| 130 | } |
124 | } |
| 131 | 125 | ||
| 132 | decode_istate(n, istate); |
126 | decode_istate(n, istate); |
| 133 | panic("general protection fault\n"); |
127 | panic("General protection fault."); |
| 134 | } |
128 | } |
| 135 | 129 | ||
| 136 | static void ss_fault(int n, istate_t *istate) |
130 | static void ss_fault(int n, istate_t *istate) |
| 137 | { |
131 | { |
| 138 | fault_if_from_uspace(istate, "stack fault"); |
132 | fault_if_from_uspace(istate, "Stack fault."); |
| 139 | decode_istate(n, istate); |
133 | decode_istate(n, istate); |
| 140 | panic("stack fault\n"); |
134 | panic("Stack fault."); |
| 141 | } |
135 | } |
| 142 | 136 | ||
| 143 | static void nm_fault(int n, istate_t *istate) |
137 | static void nm_fault(int n, istate_t *istate) |
| 144 | { |
138 | { |
| 145 | #ifdef CONFIG_FPU_LAZY |
139 | #ifdef CONFIG_FPU_LAZY |
| 146 | scheduler_fpu_lazy_request(); |
140 | scheduler_fpu_lazy_request(); |
| 147 | #else |
141 | #else |
| 148 | fault_if_from_uspace(istate, "fpu fault"); |
142 | fault_if_from_uspace(istate, "FPU fault."); |
| 149 | panic("fpu fault"); |
143 | panic("FPU fault."); |
| 150 | #endif |
144 | #endif |
| 151 | } |
145 | } |
| 152 | 146 | ||
| - | 147 | #ifdef CONFIG_SMP |
|
| 153 | static void tlb_shootdown_ipi(int n, istate_t *istate) |
148 | static void tlb_shootdown_ipi(int n, istate_t *istate) |
| 154 | { |
149 | { |
| 155 | trap_virtual_eoi(); |
150 | trap_virtual_eoi(); |
| 156 | tlb_shootdown_ipi_recv(); |
151 | tlb_shootdown_ipi_recv(); |
| 157 | } |
152 | } |
| - | 153 | #endif |
|
| 158 | 154 | ||
| 159 | /** Handler of IRQ exceptions */ |
155 | /** Handler of IRQ exceptions */ |
| 160 | static void irq_interrupt(int n, istate_t *istate) |
156 | static void irq_interrupt(int n, istate_t *istate) |
| 161 | { |
157 | { |
| 162 | ASSERT(n >= IVT_IRQBASE); |
158 | ASSERT(n >= IVT_IRQBASE); |
| Line 175... | Line 171... | ||
| 175 | if (irq->preack) { |
171 | if (irq->preack) { |
| 176 | /* Send EOI before processing the interrupt */ |
172 | /* Send EOI before processing the interrupt */ |
| 177 | trap_virtual_eoi(); |
173 | trap_virtual_eoi(); |
| 178 | ack = true; |
174 | ack = true; |
| 179 | } |
175 | } |
| 180 | irq->handler(irq, irq->arg); |
176 | irq->handler(irq); |
| 181 | spinlock_unlock(&irq->lock); |
177 | spinlock_unlock(&irq->lock); |
| 182 | } else { |
178 | } else { |
| 183 | /* |
179 | /* |
| 184 | * Spurious interrupt. |
180 | * Spurious interrupt. |
| 185 | */ |
181 | */ |
| Line 219... | Line 215... | ||
| 219 | void trap_virtual_enable_irqs(uint16_t irqmask) |
215 | void trap_virtual_enable_irqs(uint16_t irqmask) |
| 220 | { |
216 | { |
| 221 | if (enable_irqs_function) |
217 | if (enable_irqs_function) |
| 222 | enable_irqs_function(irqmask); |
218 | enable_irqs_function(irqmask); |
| 223 | else |
219 | else |
| 224 | panic("no enable_irqs_function\n"); |
220 | panic("No enable_irqs_function."); |
| 225 | } |
221 | } |
| 226 | 222 | ||
| 227 | void trap_virtual_disable_irqs(uint16_t irqmask) |
223 | void trap_virtual_disable_irqs(uint16_t irqmask) |
| 228 | { |
224 | { |
| 229 | if (disable_irqs_function) |
225 | if (disable_irqs_function) |
| 230 | disable_irqs_function(irqmask); |
226 | disable_irqs_function(irqmask); |
| 231 | else |
227 | else |
| 232 | panic("no disable_irqs_function\n"); |
228 | panic("No disable_irqs_function."); |
| 233 | } |
229 | } |
| 234 | 230 | ||
| 235 | /** @} |
231 | /** @} |
| 236 | */ |
232 | */ |