Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 80256
b: refs/heads/master
c: 8866cd9
h: refs/heads/master
v: v3
  • Loading branch information
Roland McGrath authored and Ingo Molnar committed Jan 30, 2008
1 parent 6e7548f commit b460811
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d504e39efd4e64a1a6e01dc85fd8a33fdb196dce
refs/heads/master: 8866cd9dc9d0bbadcf361a14e0cdfecb66473087
2 changes: 1 addition & 1 deletion trunk/arch/x86/kernel/head64.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void __init x86_64_start_kernel(char * real_mode_data)
zap_identity_mappings();

for (i = 0; i < IDT_ENTRIES; i++)
set_intr_gate(i, early_idt_handler);
set_intr_gate(i, &early_idt_handlers[i]);
load_idt((const struct desc_ptr *)&idt_descr);

early_printk("Kernel alive\n");
Expand Down
34 changes: 30 additions & 4 deletions trunk/arch/x86/kernel/head_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,40 @@ init_rsp:
bad_address:
jmp bad_address

.macro early_idt_tramp first, last
.ifgt \last-\first
early_idt_tramp \first, \last-1
.endif
movl $\last,%esi
jmp early_idt_handler
.endm

.globl early_idt_handlers
early_idt_handlers:
early_idt_tramp 0, 63
early_idt_tramp 64, 127
early_idt_tramp 128, 191
early_idt_tramp 192, 255

ENTRY(early_idt_handler)
cmpl $2,early_recursion_flag(%rip)
jz 1f
incl early_recursion_flag(%rip)
xorl %eax,%eax
movq 8(%rsp),%rsi # get rip
movq (%rsp),%rdx
GET_CR2_INTO_RCX
movq %rcx,%r9
xorl %r8d,%r8d # zero for error code
movl %esi,%ecx # get vector number
# Test %ecx against mask of vectors that push error code.
cmpl $31,%ecx
ja 0f
movl $1,%eax
salq %cl,%rax
testl $0x27d00,%eax
je 0f
popq %r8 # get error code
0: movq 0(%rsp),%rcx # get ip
movq 8(%rsp),%rdx # get cs
xorl %eax,%eax
leaq early_idt_msg(%rip),%rdi
call early_printk
cmpl $2,early_recursion_flag(%rip)
Expand All @@ -291,7 +317,7 @@ early_recursion_flag:
.long 0

early_idt_msg:
.asciz "PANIC: early exception rip %lx error %lx cr2 %lx\n"
.asciz "PANIC: early exception %02lx rip %lx:%lx error %lx cr2 %lx\n"
early_idt_ripmsg:
.asciz "RIP %s\n"

Expand Down
6 changes: 6 additions & 0 deletions trunk/include/asm-x86/segment.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,10 @@
#define GDT_ENTRY_TLS_ENTRIES 3
#define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES * 8)

#ifdef __KERNEL__
#ifndef __ASSEMBLY__
extern const char early_idt_handlers[IDT_ENTRIES][10];
#endif
#endif

#endif

0 comments on commit b460811

Please sign in to comment.