diff options
| author | Miguel <m.i@gmx.at> | 2018-10-17 22:52:28 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-10-17 22:52:28 +0200 |
| commit | 4d1a149531bc5d672cdf4a5a3e010662f9611d61 (patch) | |
| tree | a9bac45399bc2b09d927914c4bd34ff1338ea3b1 /kernel | |
| parent | 474c803c32fe055b4f09cb779f22b70d7eba8325 (diff) | |
starting rewriting scheduling ...v0.2
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/interrupts.c | 65 | ||||
| -rw-r--r-- | kernel/interrupts.h | 2 | ||||
| -rw-r--r-- | kernel/kernel.h | 2 | ||||
| -rw-r--r-- | kernel/spinlock.c | 1 |
4 files changed, 11 insertions, 59 deletions
diff --git a/kernel/interrupts.c b/kernel/interrupts.c index 61a03e2..b7cdd74 100644 --- a/kernel/interrupts.c +++ b/kernel/interrupts.c @@ -50,7 +50,9 @@ static void int_install_ir(int irq, uint16_t flags, uint16_t sel, void *addr) idt[irq].sel=sel; } -/** register an interrupt handler for given irq number */ +/** + * Register an interrupt handler for given irq number. + */ void interrupt_register(uint32_t irq, uint32_t func_addr) { if(irq<128||irq>160)kpanic("irq number out of range!"); @@ -65,14 +67,12 @@ 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); - - if(handlers[irq]!=0) + + if(handlers[irq]!=0)// kb,mouse,e1000,pit,... { uint32_t (*f)(uint32_t esp)=handlers[irq]; esp=f(esp); - scheduler_wake_worker(esp); - apic_eoi(); - esp=scheduler_run(esp,-1); + apic_eoi(); return esp; } @@ -93,8 +93,9 @@ uint32_t interrupt_handler(uint32_t esp, uint32_t irq) return esp; } - if(irq==INTERRUPT_SYSCALL) // do not EOI + if(irq==INTERRUPT_SYSCALL) { + apic_eoi(); uint32_t *stack; stack=esp; task_syscall(stack[11],stack[8],stack[10],stack[9]); //eax,ebx,ecx,edx @@ -104,56 +105,6 @@ uint32_t interrupt_handler(uint32_t esp, uint32_t irq) } kpanic("unhandled interrupt %d",irq); - - /* - if(handlers[irq]!=0) - { - //uint32_t (*f)(uint32_t esp)=handlers[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 - break; - - - case INTERRUPT_APIC_TIMER: // frequency is configured in smp.c (100hz) - esp=scheduler_run(esp,-1); - apic_eoi(); - break; - - case INTERRUPT_IPI: // inter process interrupt - esp=scheduler_run(esp,-1); - apic_eoi(); - break; - - case 255: // default or spurious - kpanic("Spurious/Unknown Interrupt!?"); - break; - } - - // reschedule to kernel worker on these - if(irq==INTERRUPT_SYSCALL||irq==INTERRUPT_KEYBOARD||irq==INTERRUPT_MOUSE) - { - // scheduler_wake_worker(esp); - esp=scheduler_run(esp,-1); - } - - // Ack all to LAPIC, except software syscalls - - return esp; - - */ } /** diff --git a/kernel/interrupts.h b/kernel/interrupts.h index 31b0cc0..91bc2f6 100644 --- a/kernel/interrupts.h +++ b/kernel/interrupts.h @@ -56,6 +56,8 @@ void interrupts_init(); void interrupts_install(); + +/** Register an interrupt handler for given irq number */ void interrupt_register(uint32_t irq, uint32_t func_addr); #endif diff --git a/kernel/kernel.h b/kernel/kernel.h index 2393719..9e8d5e5 100644 --- a/kernel/kernel.h +++ b/kernel/kernel.h @@ -25,7 +25,7 @@ REFERENCES #define VESA_MAX_WIDTH 1920 #define VESA_MAX_HEIGHT 1080 -#define DISABLE_E1000 +//#define DISABLE_E1000 //#define FOOLOS_UNIT_TESTING // Run Unit Tests //#define FOOLOS_LOG_OFF // Turn off logging (disables serial port alltogether) //#define FOOLOS_COLORLESS // Turn off colors in log diff --git a/kernel/spinlock.c b/kernel/spinlock.c index b7ff6b7..2a713ba 100644 --- a/kernel/spinlock.c +++ b/kernel/spinlock.c @@ -16,4 +16,3 @@ void spinlock_release(uint32_t i) uint32_t *addr=spinlocks+i; asm("movb $0,%0"::"m"(*addr)); } - |
