apic: Do not attempt an APIC flush for protocols that don't mask IRQs
This commit is contained in:
parent
5a4a6151b9
commit
dbab5f6063
@ -574,5 +574,7 @@ void linux_load(char *config, char *cmdline) {
|
||||
// Spin up
|
||||
///////////////////////////////////////
|
||||
|
||||
irq_flush_type = IRQ_PIC_ONLY_FLUSH;
|
||||
|
||||
common_spinup(linux_spinup, 2, (void *)kernel_load_addr, boot_params);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <lib/term.h>
|
||||
#include <sys/pic.h>
|
||||
#include <sys/cpu.h>
|
||||
#include <sys/idt.h>
|
||||
#include <fs/file.h>
|
||||
#include <mm/vmm.h>
|
||||
#include <mm/pmm.h>
|
||||
@ -276,6 +277,8 @@ nofb:;
|
||||
multiboot1_info.mmap_addr = ((uint32_t)(size_t)mmap);
|
||||
multiboot1_info.flags |= (1 << 0) | (1 << 6);
|
||||
|
||||
irq_flush_type = IRQ_PIC_ONLY_FLUSH;
|
||||
|
||||
common_spinup(multiboot1_spinup_32, 2,
|
||||
entry_point, (uint32_t)(uintptr_t)&multiboot1_info);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <lib/term.h>
|
||||
#include <sys/pic.h>
|
||||
#include <sys/cpu.h>
|
||||
#include <sys/idt.h>
|
||||
#include <fs/file.h>
|
||||
#include <mm/vmm.h>
|
||||
#include <lib/acpi.h>
|
||||
@ -532,6 +533,8 @@ void multiboot2_load(char *config, char* cmdline) {
|
||||
append_tag(info_idx, end_tag);
|
||||
}
|
||||
|
||||
irq_flush_type = IRQ_PIC_ONLY_FLUSH;
|
||||
|
||||
common_spinup(multiboot2_spinup_32, 2,
|
||||
entry_point, (uint32_t)(uintptr_t)mbi_start);
|
||||
}
|
||||
|
@ -426,6 +426,8 @@ __attribute__((noreturn)) void stivale_spinup(
|
||||
pic_mask_all();
|
||||
io_apic_mask_all();
|
||||
|
||||
irq_flush_type = IRQ_PIC_APIC_FLUSH;
|
||||
|
||||
common_spinup(stivale_spinup_32, 10,
|
||||
bits, level5pg, enable_nx, (uint32_t)(uintptr_t)pagemap->top_level,
|
||||
(uint32_t)entry_point, (uint32_t)(entry_point >> 32),
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <sys/pic.h>
|
||||
#include <sys/lapic.h>
|
||||
#include <mm/pmm.h>
|
||||
#include <lib/blib.h>
|
||||
|
||||
static struct idt_entry *dummy_idt = NULL;
|
||||
|
||||
@ -31,7 +32,21 @@ void init_flush_irqs(void) {
|
||||
}
|
||||
}
|
||||
|
||||
int irq_flush_type = IRQ_NO_FLUSH;
|
||||
|
||||
void flush_irqs(void) {
|
||||
switch (irq_flush_type) {
|
||||
case IRQ_PIC_ONLY_FLUSH:
|
||||
pic_flush();
|
||||
// FALLTHRU
|
||||
case IRQ_NO_FLUSH:
|
||||
return;
|
||||
case IRQ_PIC_APIC_FLUSH:
|
||||
break;
|
||||
default:
|
||||
panic("Invalid IRQ flush type");
|
||||
}
|
||||
|
||||
struct idtr old_idt;
|
||||
asm volatile ("sidt %0" : "=m"(old_idt) :: "memory");
|
||||
|
||||
|
@ -45,6 +45,14 @@ void init_idt(void);
|
||||
|
||||
#endif
|
||||
|
||||
enum {
|
||||
IRQ_NO_FLUSH,
|
||||
IRQ_PIC_ONLY_FLUSH,
|
||||
IRQ_PIC_APIC_FLUSH
|
||||
};
|
||||
|
||||
extern int irq_flush_type;
|
||||
|
||||
void init_flush_irqs(void);
|
||||
void flush_irqs(void);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user