diff options
Diffstat (limited to 'kernel/interrupts.c')
| -rw-r--r-- | kernel/interrupts.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/kernel/interrupts.c b/kernel/interrupts.c index e91d3ae..8bff84b 100644 --- a/kernel/interrupts.c +++ b/kernel/interrupts.c @@ -64,8 +64,9 @@ void interrupt_register(uint32_t irq, uint32_t func_addr) */ uint32_t interrupt_handler(uint32_t esp, uint32_t irq) { - + uint32_t cpu=smp_get(SMP_APIC_ID); uint32_t *stack; + static uint32_t timer=0; if(handlers[irq]!=0) { @@ -73,29 +74,38 @@ uint32_t interrupt_handler(uint32_t esp, uint32_t irq) esp=f(esp); apic_eoi(); } + else if(irq!=INTERRUPT_SYSCALL&&irq!=INTERRUPT_IPI&&irq!=INTERRUPT_APIC_TIMER) { kpanic("unhandled interrupt %d",irq); } - // process IRQ switch(irq) { case INTERRUPT_SYSCALL: stack=esp; task_syscall(stack[11],stack[8],stack[10],stack[9]); //eax,ebx,ecx,edx - esp=scheduler_wake_worker(esp); break; - case INTERRUPT_APIC_TIMER: // frequency is configured in smp.c - compositor_swap_buffers(); - esp=scheduler_run(esp,-1); + + case INTERRUPT_APIC_TIMER: // frequency is configured in smp.c (100hz) + + if(cpu==0) + { + timer++; + if(timer==10){ + compositor_swap_buffers(); + esp=scheduler_run(esp,-1); + timer=0; + } + } + apic_eoi(); break; case INTERRUPT_IPI: // inter process interrupt - esp=scheduler_run(esp,0); + esp=scheduler_run(esp,-1); apic_eoi(); break; @@ -107,7 +117,8 @@ uint32_t interrupt_handler(uint32_t esp, uint32_t irq) // reschedule to kernel worker on these if(irq==INTERRUPT_SYSCALL||irq==INTERRUPT_KEYBOARD||irq==INTERRUPT_MOUSE) { - esp=scheduler_wake_worker(esp); + scheduler_wake_worker(esp); + esp=scheduler_run(esp,-1); } // Ack all to LAPIC, except software syscalls |
