summaryrefslogtreecommitdiff
path: root/kernel/interrupts.c
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-09-07 03:01:28 +0200
committerMiguel <m.i@gmx.at>2018-09-07 03:01:28 +0200
commitaa4b4c6c1918a51318709761873d1c5e248a831d (patch)
treebdcfe7be159cc778d113538722e119a665a47738 /kernel/interrupts.c
parentef4943053475cd8bf341c42dd0b538bc630b92a3 (diff)
apic timer smp
Diffstat (limited to 'kernel/interrupts.c')
-rw-r--r--kernel/interrupts.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/kernel/interrupts.c b/kernel/interrupts.c
index 4eb2a35..f93de9e 100644
--- a/kernel/interrupts.c
+++ b/kernel/interrupts.c
@@ -6,7 +6,7 @@
#include "asm_x86.h"
/** The size of our interrupts table */
-#define INT_MAX 255
+#define INT_MAX 256 // 0-255
/** The interrupt descriptor table */
static struct int_desc
@@ -83,6 +83,10 @@ 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==255)kpanic("Unhandled Interrupt!");
return esp;
@@ -107,8 +111,8 @@ void show_selector_error(uint32_t err)
{
klog("Selector Error Details:");
klog("External Event: %x",err&0b1);
- klog("Location: %x",err&0b110);
- klog("Selector: %x",err&0b1111111111111000);
+ klog("Location: 0x%x (0-GDT/1-IDT/2-LDT/3-IDT)",err&0b110);
+ klog("Selector: 0x%x",err&0b1111111111111000);
}
void show_page_fault_error(uint32_t error_code)
@@ -242,9 +246,13 @@ void interrupts_init(uint16_t sel)
// System Calls / they can be called from ring3 (0b11)
int_install_ir(0x80, 0b11101110, 0x08,&int128);
+
// Wake Scheduler
int_install_ir(0x81, 0b11101110, 0x08,&int129);
+ // APIC Timer
+ int_install_ir(200, 0b11101110, 0x08,&int200);
+
// install IVT
int_install();
}