diff options
author | Roland McGrath <roland@redhat.com> | 2008-01-30 07:33:06 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:33:06 -0500 |
commit | 8866cd9dc9d0bbadcf361a14e0cdfecb66473087 (patch) | |
tree | d6780e43633c56a017618e615c92bb7854876686 /arch/x86/kernel/head_64.S | |
parent | d504e39efd4e64a1a6e01dc85fd8a33fdb196dce (diff) |
x86: early_idt_handler improvements, 64-bit
It's not too pretty, but I found this made the "PANIC: early exception"
messages become much more reliably useful: 1. print the vector number,
2. print the %cs value, 3. handle error-code-pushing vs non-pushing vectors.
Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/head_64.S')
-rw-r--r-- | arch/x86/kernel/head_64.S | 34 |
1 files changed, 30 insertions, 4 deletions
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 | ||