diff options
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/head64.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/head_64.S | 34 |
2 files changed, 31 insertions, 5 deletions
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index 4a1c1356c41a..85c1e6bf8022 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c | |||
@@ -59,7 +59,7 @@ void __init x86_64_start_kernel(char * real_mode_data) | |||
59 | zap_identity_mappings(); | 59 | zap_identity_mappings(); |
60 | 60 | ||
61 | for (i = 0; i < IDT_ENTRIES; i++) | 61 | for (i = 0; i < IDT_ENTRIES; i++) |
62 | set_intr_gate(i, early_idt_handler); | 62 | set_intr_gate(i, &early_idt_handlers[i]); |
63 | load_idt((const struct desc_ptr *)&idt_descr); | 63 | load_idt((const struct desc_ptr *)&idt_descr); |
64 | 64 | ||
65 | early_printk("Kernel alive\n"); | 65 | early_printk("Kernel alive\n"); |
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S index c31b1c96a9d3..8b4c35cb519a 100644 --- a/arch/x86/kernel/head_64.S +++ b/arch/x86/kernel/head_64.S | |||
@@ -267,14 +267,40 @@ init_rsp: | |||
267 | bad_address: | 267 | bad_address: |
268 | jmp bad_address | 268 | jmp bad_address |
269 | 269 | ||
270 | .macro early_idt_tramp first, last | ||
271 | .ifgt \last-\first | ||
272 | early_idt_tramp \first, \last-1 | ||
273 | .endif | ||
274 | movl $\last,%esi | ||
275 | jmp early_idt_handler | ||
276 | .endm | ||
277 | |||
278 | .globl early_idt_handlers | ||
279 | early_idt_handlers: | ||
280 | early_idt_tramp 0, 63 | ||
281 | early_idt_tramp 64, 127 | ||
282 | early_idt_tramp 128, 191 | ||
283 | early_idt_tramp 192, 255 | ||
284 | |||
270 | ENTRY(early_idt_handler) | 285 | ENTRY(early_idt_handler) |
271 | cmpl $2,early_recursion_flag(%rip) | 286 | cmpl $2,early_recursion_flag(%rip) |
272 | jz 1f | 287 | jz 1f |
273 | incl early_recursion_flag(%rip) | 288 | incl early_recursion_flag(%rip) |
274 | xorl %eax,%eax | ||
275 | movq 8(%rsp),%rsi # get rip | ||
276 | movq (%rsp),%rdx | ||
277 | GET_CR2_INTO_RCX | 289 | GET_CR2_INTO_RCX |
290 | movq %rcx,%r9 | ||
291 | xorl %r8d,%r8d # zero for error code | ||
292 | movl %esi,%ecx # get vector number | ||
293 | # Test %ecx against mask of vectors that push error code. | ||
294 | cmpl $31,%ecx | ||
295 | ja 0f | ||
296 | movl $1,%eax | ||
297 | salq %cl,%rax | ||
298 | testl $0x27d00,%eax | ||
299 | je 0f | ||
300 | popq %r8 # get error code | ||
301 | 0: movq 0(%rsp),%rcx # get ip | ||
302 | movq 8(%rsp),%rdx # get cs | ||
303 | xorl %eax,%eax | ||
278 | leaq early_idt_msg(%rip),%rdi | 304 | leaq early_idt_msg(%rip),%rdi |
279 | call early_printk | 305 | call early_printk |
280 | cmpl $2,early_recursion_flag(%rip) | 306 | cmpl $2,early_recursion_flag(%rip) |
@@ -291,7 +317,7 @@ early_recursion_flag: | |||
291 | .long 0 | 317 | .long 0 |
292 | 318 | ||
293 | early_idt_msg: | 319 | early_idt_msg: |
294 | .asciz "PANIC: early exception rip %lx error %lx cr2 %lx\n" | 320 | .asciz "PANIC: early exception %02lx rip %lx:%lx error %lx cr2 %lx\n" |
295 | early_idt_ripmsg: | 321 | early_idt_ripmsg: |
296 | .asciz "RIP %s\n" | 322 | .asciz "RIP %s\n" |
297 | 323 | ||