};
const char *hypervisor_name;
- /* Critical region without IDT or TSS. Any fault is deadly! */
+ /* Critical region without exception handling. Any fault is deadly! */
init_shadow_spec_ctrl_state();
percpu_init_areas();
- init_idt_traps();
- load_system_tables();
+ early_traps_init();
smp_prepare_boot_cpu();
sort_exception_tables();
setup_force_cpu_cap(X86_FEATURE_XEN_LBR);
}
+/*
+ * Configure basic exception handling. This is prior to parsing the command
+ * line or configuring a console, and needs to be as simple as possible.
+ *
+ * boot_gdt is already loaded, and bsp_idt[] is constructed without IST
+ * settings, so we don't need a TSS configured yet.
+ */
+void __init early_traps_init(void)
+{
+ const struct desc_ptr idtr = {
+ .base = (unsigned long)bsp_idt,
+ .limit = sizeof(bsp_idt) - 1,
+ };
+
+ lidt(&idtr);
+
+ /* Invalidate TR/LDTR as they're not set up yet. */
+ _set_tssldt_desc(boot_gdt + TSS_ENTRY - FIRST_RESERVED_GDT_ENTRY,
+ 0, 0, SYS_DESC_tss_avail);
+
+ ltr(TSS_SELECTOR);
+ lldt(0);
+
+ /* Set up the BSPs per-cpu references. */
+ this_cpu(idt) = bsp_idt;
+ this_cpu(gdt) = boot_gdt;
+ if ( IS_ENABLED(CONFIG_PV32) )
+ this_cpu(compat_gdt) = boot_compat_gdt;
+}
+
/*
* Configure complete exception, interrupt and syscall handling.
*/
/* Replace early pagefault with real pagefault handler. */
_update_gate_addr_lower(&bsp_idt[X86_EXC_PF], entry_PF);
+ load_system_tables();
+
init_ler();
/* Cache {,compat_}gdt_l1e now that physically relocation is done. */
panic("CONTROL-FLOW PROTECTION FAULT: #CP[%04x] %s\n", ec, err);
}
-void __init init_idt_traps(void)
-{
- /* Specify dedicated interrupt stacks for NMI, #DF, and #MC. */
- enable_each_ist(bsp_idt);
-
- /* CPU0 uses the master IDT. */
- this_cpu(idt) = bsp_idt;
-
- this_cpu(gdt) = boot_gdt;
- if ( IS_ENABLED(CONFIG_PV32) )
- this_cpu(compat_gdt) = boot_compat_gdt;
-}
-
void asm_domain_crash_synchronous(unsigned long addr)
{
/*