summaryrefslogtreecommitdiff
path: root/kernel/interrupts.c
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-09-29 19:57:52 +0200
committerMiguel <m.i@gmx.at>2018-09-29 19:57:52 +0200
commit75433d155c152b809e9f25b1099fc06d6106308b (patch)
treef4f84309e6cf2aa9bc0d9df5ae532b94a60fea0f /kernel/interrupts.c
parent73e80bf4b6c69b92a04b525f114a072a1c4b0d3a (diff)
improving window compositor
Diffstat (limited to 'kernel/interrupts.c')
-rw-r--r--kernel/interrupts.c27
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