diff options
| author | Miguel <m.i@gmx.at> | 2018-09-08 17:08:55 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-09-08 17:08:55 +0200 |
| commit | 9fde748acea83d775e367a64858414b674f05b13 (patch) | |
| tree | 0927b570c07c9ee469817a560b965c094c5d8145 /kernel/interrupts.c | |
| parent | aa4b4c6c1918a51318709761873d1c5e248a831d (diff) | |
struggling with pic and lapic and smp...
Diffstat (limited to 'kernel/interrupts.c')
| -rw-r--r-- | kernel/interrupts.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/kernel/interrupts.c b/kernel/interrupts.c index f93de9e..acf781d 100644 --- a/kernel/interrupts.c +++ b/kernel/interrupts.c @@ -57,12 +57,19 @@ void int_install() uint32_t interrupt_handler(uint32_t esp, uint32_t irq) { + + // DO NOT WRITE INSIDE INTERRUPTS!! COZ IT ACQUIRES LOCK AND WE WILL DEADLOCK +// klog("int: %d on 0x%x",irq,apicID()); if(irq==0)asm_pit_tick(); // mouse and kb if(irq==1 || irq==12 ){ uint32_t in=x86_inb(0x60); - if(irq=1)keyboard_handle(in); // do this in separate thread! + if(irq==1)keyboard_handle(in); // do this in separate thread! + // TODO: mouse + + // test ipi + apicIPI(2,170); // klog("0x60 in %d",in); } @@ -83,11 +90,14 @@ uint32_t interrupt_handler(uint32_t esp, uint32_t irq) if(irq==0 || irq==129)esp=my_scheduler(esp,-1); // autoschedule - if(irq==200){ - klog("tick"); - writeAPIC(0xB0,0); // apic EOI + if(irq==200){ // apic timer + apicEOI(); } if(irq==255)kpanic("Unhandled Interrupt!"); + if(irq==170){ +// if(apicID()!=0)apicIPI(0,170); + apicEOI(); + } return esp; } @@ -130,6 +140,7 @@ void exception_handle(uint32_t esp, uint32_t irq) { uint32_t error_code=0; + klog("EXCEPTION: apicID: 0x%08X",apicID()); klog("EXCEPTION: vector nr.: %d",irq); switch(irq){ //this interrupts push also an error_code @@ -198,10 +209,6 @@ void exception_handle(uint32_t esp, uint32_t irq) // set default handler for all interrupts for a start void interrupts_init(uint16_t sel) { - // Setup PIC - klog("setting up PIC",&idt,&idtd); - asm_pic_setup(); - klog("initializing. IDT: 0x%08x, IDTD: 0x%08X",&idt,&idtd); // Default interrupt handling @@ -250,6 +257,9 @@ void interrupts_init(uint16_t sel) // Wake Scheduler int_install_ir(0x81, 0b11101110, 0x08,&int129); + // Wake SMP Scheduler + int_install_ir(0xAA, 0b11101110, 0x08,&int170); + // APIC Timer int_install_ir(200, 0b11101110, 0x08,&int200); |
