Disabling IRQs doesn't works [SOLVED]
Posted: Thu May 05, 2011 1:42 pm
Hello,
I'm writing a round robin scheduler for kernel threads.
I'm disabling interrupts before processing threads in a scheduler and enable them after the scheduler routine executed but IRQs aren't disabled: an assert reports it.
There is the code:
I also tried with and but the result is the same.
The IRQs #defines are:
I have not idea where I failed. Does someone has an idea please?
The whole code: http://versatile.git.sourceforge.net/gi ... ;a=summary
Interrupt part: http://versatile.git.sourceforge.net/gi ... 0d705af344
IRQ part: http://versatile.git.sourceforge.net/gi ... 0d705af344
I'm writing a round robin scheduler for kernel threads.
I'm disabling interrupts before processing threads in a scheduler and enable them after the scheduler routine executed but IRQs aren't disabled: an assert reports it.
There is the code:
Code: Select all
void timer_interrupt_handler(int interrupt_id)
{
static int tick = 0;
static int sec = 0;
uint32 flags;
tick++;
vga_display_string("Tick:%d\n", tick);
if (tick % 100 == 0)
{
sec++;
tick = 0;
}
x86_irq_disable_all(flags);
schedule();
x86_irq_restore_all(flags);
/* Execute the expired timeout actions (if any) */
/*
if ( time_do_tick() != KERNEL_OK)
vga_display_string("time subsystem error!\n");*/
}
Code: Select all
__asm__ __volatile__("cli\n");
Code: Select all
__asm__ __volatile__("sti\n");
The IRQs #defines are:
Code: Select all
#define x86_save_flags(flags) \
asm volatile("pushfl ; popl %0":"=g"(flags)::"memory")
#define x86_restore_flags(flags) \
asm volatile("push %0; popfl"::"g"(flags):"memory")
#define x86_irq_disable_all(flags) \
({ x86_save_flags(flags); asm("cli\n"); })
#define x86_irq_restore_all(flags) \
x86_restore_flags(flags)
The whole code: http://versatile.git.sourceforge.net/gi ... ;a=summary
Interrupt part: http://versatile.git.sourceforge.net/gi ... 0d705af344
IRQ part: http://versatile.git.sourceforge.net/gi ... 0d705af344