[kernel] Make IDT per-cpu, not global

Since we modify IST entries while handling interrupts, the IDT cannot be
a global data structure. Allocate new ones for each CPU.
This commit is contained in:
Justin C. Miller
2021-02-19 21:51:25 -08:00
parent 2d6987341c
commit 6a41446185
7 changed files with 28 additions and 19 deletions

View File

@@ -41,7 +41,7 @@ cpu_validate()
void
cpu_early_init(cpu_data *cpu)
{
IDT::get().install();
cpu->idt->install();
cpu->gdt->install();
// Install the GS base pointint to the cpu_data
@@ -63,4 +63,6 @@ cpu_init(cpu_data *cpu, bool bsp)
uint64_t pat = rdmsr(msr::ia32_pat);
pat = (pat & 0x00ffffffffffffffull) | (0x01ull << 56); // set PAT 7 to WC
wrmsr(msr::ia32_pat, pat);
cpu->idt->add_ist_entries();
}