From 0410594ae84faa296edd65016528065c91402e62 Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Sat, 30 Jul 2011 22:47:27 +0200 Subject: [PATCH] fix bug in handling the timer interrupt => sending EOI before task switching --- arch/x86/kernel/irq.c | 7 ++++++- arch/x86/kernel/timer.c | 7 ++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c index d4de077c..04ddecf4 100644 --- a/arch/x86/kernel/irq.c +++ b/arch/x86/kernel/irq.c @@ -253,7 +253,7 @@ void irq_handler(struct state *s) */ if (apic_is_enabled() || s->int_no >= 123) { apic_eoi(); - return; + goto leave_handler; } #ifndef CONFIG_ROCKCREEK @@ -273,4 +273,9 @@ void irq_handler(struct state *s) #else kprintf("Upps, RockCreek uses IRQs below 123!\n"); #endif + +leave_handler: + // timer interrupt? + if ((s->int_no == 32) || (s->int_no == 123)) + scheduler(); // switch to a new task } diff --git a/arch/x86/kernel/timer.c b/arch/x86/kernel/timer.c index 8de626fb..251f71f8 100644 --- a/arch/x86/kernel/timer.c +++ b/arch/x86/kernel/timer.c @@ -69,15 +69,12 @@ static void timer_handler(struct state *s) #endif /* - * Every TIMER_FREQ clocks (approximately 1 second), we will + * Every TIMER_FREQ clocks (approximately 1 second), we will * display a message on the screen - */ + */ /*if (timer_ticks % TIMER_FREQ == 0) { vga_puts("One second has passed\n"); }*/ - - // switch to a new task - scheduler(); } /*