diff options
| author | Miguel <m.i@gmx.at> | 2018-09-15 17:53:27 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-09-15 17:53:27 +0200 |
| commit | cd50c8d1047832bbb0798b368fde0428ef749422 (patch) | |
| tree | fcacf85f58fefeffa482630f31ef208a8bc9d03a /kernel/interrupts.c | |
| parent | 0b010d22dbf845ad030e2e7320f9c5935b2604a4 (diff) | |
improved in-kernel alloc/dealloc. addded colorless logging and struggling with mouse and kb
Diffstat (limited to 'kernel/interrupts.c')
| -rw-r--r-- | kernel/interrupts.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/kernel/interrupts.c b/kernel/interrupts.c index 9e12555..150a784 100644 --- a/kernel/interrupts.c +++ b/kernel/interrupts.c @@ -51,43 +51,57 @@ static void int_install_ir(int irq, uint16_t flags, uint16_t sel, void *addr) */ uint32_t interrupt_handler(uint32_t esp, uint32_t irq) { + // pit timer at 1/25 sec. if(irq==INTERRUPT_PIT_TIMER)asm_pit_tick(); - // mouse and kb - if(irq==INTERRUPT_KEYBOARD || irq==INTERRUPT_MOUSE){ + // kb + if(irq==INTERRUPT_KEYBOARD) + { + uint32_t in=x86_inb(0x60); + } + + // mouse + if(irq==INTERRUPT_MOUSE) + { uint32_t in=x86_inb(0x60); + + /* if(irq==INTERRUPT_KEYBOARD){ keyboard_handle(in); // do this in separate thread via syscalls? task_wake_all(); } + */ // TODO: mouse // test ipi - apic_ipi(2,0x81); // force cpu16 to autoschedule? just test + //apic_ipi(2,0x81); // force cpu16 to autoschedule? just test //klog("0x60 in %d",in); } // 0x80 - a syscall is coming in - if(irq==INTERRUPT_SYSCALL){ - + if(irq==INTERRUPT_SYSCALL) + { uint32_t *stack=esp; uint32_t eax=stack[11]; uint32_t ebx=stack[8]; uint32_t ecx=stack[10]; uint32_t edx=stack[9]; -// klog("syscall: %d (ebx=0x%08X,ecx=0x%08X,edx=0x%08X)",eax,ebx,ecx,edx); - task_syscall(eax,ebx,ecx,edx); - esp=scheduler_run(esp,2); // force scheduling of pid=2 (kernel worker) + esp=scheduler_run(esp,2); } // schedules on APIC timer 0x8C and IPI 0x81 - if(irq==INTERRUPT_APIC_TIMER || irq==INTERRUPT_IPI)esp=scheduler_run(esp,-1); // autoschedule + if(irq==INTERRUPT_APIC_TIMER || irq==INTERRUPT_IPI) + { + esp=scheduler_run(esp,-1); + } - if(irq!=INTERRUPT_SYSCALL)apic_eoi(); // ack all except software syscalls + // ack all except software syscalls + if(irq!=INTERRUPT_SYSCALL)apic_eoi(); - if(irq==255)kpanic("Spurious/Unknown Interrupt!?"); // default and spurious + // default and spurious + if(irq==255)kpanic("Spurious/Unknown Interrupt!?"); return esp; } |
