From 4805e62467cb33ef9747b4024e60ca9f67ac63d5 Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Thu, 20 Aug 2015 14:15:52 +0200 Subject: [PATCH] use generic numbers for the IPIs (shutdown, TLB shootdown) --- hermit/arch/x86/kernel/apic.c | 4 ++-- hermit/arch/x86/kernel/entry.asm | 12 ++++++------ hermit/arch/x86/kernel/irq.c | 10 +++++++--- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/hermit/arch/x86/kernel/apic.c b/hermit/arch/x86/kernel/apic.c index 63276083d..d775e3f96 100644 --- a/hermit/arch/x86/kernel/apic.c +++ b/hermit/arch/x86/kernel/apic.c @@ -714,9 +714,9 @@ int apic_init(void) // set APIC error handler irq_install_handler(126, apic_err_handler); #if MAX_CORES > 1 - irq_install_handler(124, apic_tlb_handler); + irq_install_handler(80+32, apic_tlb_handler); #endif - irq_install_handler(122, apic_shutdown); + irq_install_handler(81+32, apic_shutdown); kprintf("Boot processor %u (ID %u)\n", boot_processor, apic_processors[boot_processor]->id); online[boot_processor] = 1; diff --git a/hermit/arch/x86/kernel/entry.asm b/hermit/arch/x86/kernel/entry.asm index 417c9d737..4662f88a6 100644 --- a/hermit/arch/x86/kernel/entry.asm +++ b/hermit/arch/x86/kernel/entry.asm @@ -289,12 +289,12 @@ isrstub_pseudo_error 9 %assign i i+1 %endrep -global apic_shutdown -align 16 -apic_shutdown: - push byte 0 ; pseudo error code - push byte 122 - jmp common_stub +; Create entries for the interrupts 80 to 81 +%assign i 80 +%rep 2 + irqstub i +%assign i i+1 +%endrep global apic_timer align 16 diff --git a/hermit/arch/x86/kernel/irq.c b/hermit/arch/x86/kernel/irq.c index 9fa6058fe..fbab3f5dd 100644 --- a/hermit/arch/x86/kernel/irq.c +++ b/hermit/arch/x86/kernel/irq.c @@ -71,7 +71,8 @@ extern void irq20(void); extern void irq21(void); extern void irq22(void); extern void irq23(void); -extern void apic_shutdown(void); +extern void irq80(void); +extern void irq81(void); extern void apic_timer(void); extern void apic_lint0(void); extern void apic_lint1(void); @@ -211,9 +212,12 @@ static int irq_install(void) idt_set_gate(55, (size_t)irq23, KERNEL_CODE_SELECTOR, IDT_FLAG_PRESENT|IDT_FLAG_RING0|IDT_FLAG_32BIT|IDT_FLAG_INTTRAP); + idt_set_gate(112, (size_t)irq80, KERNEL_CODE_SELECTOR, + IDT_FLAG_PRESENT|IDT_FLAG_RING0|IDT_FLAG_32BIT|IDT_FLAG_INTTRAP); + idt_set_gate(113, (size_t)irq81, KERNEL_CODE_SELECTOR, + IDT_FLAG_PRESENT|IDT_FLAG_RING0|IDT_FLAG_32BIT|IDT_FLAG_INTTRAP); + // add APIC interrupt handler - idt_set_gate(122, (size_t)apic_shutdown, KERNEL_CODE_SELECTOR, - IDT_FLAG_PRESENT|IDT_FLAG_RING0|IDT_FLAG_32BIT|IDT_FLAG_INTTRAP); idt_set_gate(123, (size_t)apic_timer, KERNEL_CODE_SELECTOR, IDT_FLAG_PRESENT|IDT_FLAG_RING0|IDT_FLAG_32BIT|IDT_FLAG_INTTRAP); idt_set_gate(124, (size_t)apic_lint0, KERNEL_CODE_SELECTOR,