x86/idt: Consolidate idt functionality

- Move load_current_idt() out of line and replace the hideous comment with
   a lockdep assert. This allows to make idt_table and idt_descr static.

 - Mark idt_table read only after the IDT initialization is complete.

 - Shuffle code around to consolidate the #ifdef sections into one.

 - Adapt the F00F bug code.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20200528145523.084915381@linutronix.de
This commit is contained in:
Thomas Gleixner
2020-05-28 16:53:20 +02:00
parent 00229a5430
commit 3e77abda65
3 changed files with 44 additions and 52 deletions

View File

@@ -414,21 +414,13 @@ static int is_errata100(struct pt_regs *regs, unsigned long address)
return 0;
}
/* Pentium F0 0F C7 C8 bug workaround: */
static int is_f00f_bug(struct pt_regs *regs, unsigned long address)
{
#ifdef CONFIG_X86_F00F_BUG
unsigned long nr;
/*
* Pentium F0 0F C7 C8 bug workaround:
*/
if (boot_cpu_has_bug(X86_BUG_F00F)) {
nr = (address - idt_descr.address) >> 3;
if (nr == 6) {
handle_invalid_op(regs);
return 1;
}
if (boot_cpu_has_bug(X86_BUG_F00F) && idt_is_f00f_address(address)) {
handle_invalid_op(regs);
return 1;
}
#endif
return 0;