summaryrefslogtreecommitdiff
path: root/kernel/interrupts.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/interrupts.c')
-rw-r--r--kernel/interrupts.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/kernel/interrupts.c b/kernel/interrupts.c
index 30d8994..992889f 100644
--- a/kernel/interrupts.c
+++ b/kernel/interrupts.c
@@ -60,7 +60,9 @@ 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();
+ if(irq==0){
+ asm_pit_tick();
+ }
// mouse and kb
if(irq==1 || irq==12 ){
@@ -69,7 +71,7 @@ uint32_t interrupt_handler(uint32_t esp, uint32_t irq)
// TODO: mouse
// test ipi
- apicIPI(2,170);
+// apicIPI(2,170);
// klog("0x60 in %d",in);
}
@@ -90,15 +92,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){ // apic timer
- apicEOI();
- }
- if(irq==255)kpanic("Unhandled Interrupt!");
+ if(irq==200){} // apic timer
if(irq==170){
// if(apicID()!=0)apicIPI(0,170);
- apicEOI();
}
+ //if(irq==255)kpanic("Unhandled Interrupt!");
+
+ if(irq!=0x81 && irq!=0x80)apicEOI();
return esp;
}
@@ -238,30 +239,25 @@ void interrupts_init(uint16_t sel)
int_install_ir(17, 0b10001110, 0x08,&exc17);
int_install_ir(18, 0b10001110, 0x08,&exc18);
+ // PIT
+ int_install_ir(0x90, 0b10001110, 0x08,&int0);
- // Custom interrupts (hardcoded)
- // remember that we shifted all interrupts with the pic by 32
-
- // PIT interrupt handler (irq 0 => 32)
- int_install_ir(32, 0b10001110, 0x08,&int0);
-
- // Keyboard interrupt handler (irq 1 => 33)
- int_install_ir(33, 0b10001110, 0x08,&int1);
+ // Keyboard
+ int_install_ir(0x91, 0b10001110, 0x08,&int1);
- // Mouse interrupt handler (irq 12 => 34)
- int_install_ir(44, 0b10001110, 0x08,&int12);
+ // Mouse
+ int_install_ir(0x92, 0b10001110, 0x08,&int12);
// System Calls / they can be called from ring3 (0b11)
int_install_ir(0x80, 0b11101110, 0x08,&int128);
- // Wake Scheduler
+ // IPI
int_install_ir(0x81, 0b11101110, 0x08,&int129);
- // Wake SMP Scheduler
- int_install_ir(0xAA, 0b11101110, 0x08,&int170);
+ int_install_ir(170, 0b11101110, 0x08,&int170);
// APIC Timer
- int_install_ir(200, 0b11101110, 0x08,&int200);
+ int_install_ir(0x8C, 0b11101110, 0x08,&int200);
// install IVT
int_install();