mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 21:57:43 +00:00
x86-64: don't set the early IDT to point directly to 'early_idt_handler'
The code requires the use of the proper per-exception-vector stub
functions (set up as the early_idt_handlers[] array - note the 's') that
make sure to set up the error vector number. This is true regardless of
whether CONFIG_EARLY_PRINTK is set or not.
Why? The stack offset for the comparison of __KERNEL_CS won't be right
otherwise, nor will the new check (from commit 8170e6bed4
: "x86,
64bit: Use a #PF handler to materialize early mappings on demand") for
the page fault exception vector.
Acked-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
2ef14f465b
commit
ac630dd98a
3 changed files with 3 additions and 8 deletions
|
@ -5,8 +5,6 @@
|
||||||
|
|
||||||
/* misc architecture specific prototypes */
|
/* misc architecture specific prototypes */
|
||||||
|
|
||||||
void early_idt_handler(void);
|
|
||||||
|
|
||||||
void system_call(void);
|
void system_call(void);
|
||||||
void syscall_init(void);
|
void syscall_init(void);
|
||||||
|
|
||||||
|
|
|
@ -159,13 +159,8 @@ void __init x86_64_start_kernel(char * real_mode_data)
|
||||||
/* clear bss before set_intr_gate with early_idt_handler */
|
/* clear bss before set_intr_gate with early_idt_handler */
|
||||||
clear_bss();
|
clear_bss();
|
||||||
|
|
||||||
for (i = 0; i < NUM_EXCEPTION_VECTORS; i++) {
|
for (i = 0; i < NUM_EXCEPTION_VECTORS; i++)
|
||||||
#ifdef CONFIG_EARLY_PRINTK
|
|
||||||
set_intr_gate(i, &early_idt_handlers[i]);
|
set_intr_gate(i, &early_idt_handlers[i]);
|
||||||
#else
|
|
||||||
set_intr_gate(i, early_idt_handler);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
load_idt((const struct desc_ptr *)&idt_descr);
|
load_idt((const struct desc_ptr *)&idt_descr);
|
||||||
|
|
||||||
copy_bootdata(__va(real_mode_data));
|
copy_bootdata(__va(real_mode_data));
|
||||||
|
|
|
@ -336,6 +336,7 @@ early_idt_handlers:
|
||||||
i = i + 1
|
i = i + 1
|
||||||
.endr
|
.endr
|
||||||
|
|
||||||
|
/* This is global to keep gas from relaxing the jumps */
|
||||||
ENTRY(early_idt_handler)
|
ENTRY(early_idt_handler)
|
||||||
cld
|
cld
|
||||||
|
|
||||||
|
@ -404,6 +405,7 @@ ENTRY(early_idt_handler)
|
||||||
addq $16,%rsp # drop vector number and error code
|
addq $16,%rsp # drop vector number and error code
|
||||||
decl early_recursion_flag(%rip)
|
decl early_recursion_flag(%rip)
|
||||||
INTERRUPT_RETURN
|
INTERRUPT_RETURN
|
||||||
|
ENDPROC(early_idt_handler)
|
||||||
|
|
||||||
__INITDATA
|
__INITDATA
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue