[MULTITASKING] Preemptive multitasking

This commit is contained in:
2016-11-18 10:36:21 +01:00
parent d3d065b2e2
commit 664379b35c
7 changed files with 26 additions and 8 deletions

View File

@@ -3,6 +3,7 @@
#include <msr.h>
#include <debug.h>
#include <mem.h>
#include <scheduler.h>
#define APIC_MSR_ENABLE 0x800
@@ -62,8 +63,7 @@ registers_t *apic_timer_handler(registers_t *r)
{
// APIC timer timeout occurred
APIC(R_EOI) = 0;
debug_putch('-');
apic_timer(1000000);
schedule();
return r;
}
void apic_timer(uint64_t us)
@@ -112,6 +112,4 @@ void apic_init()
// Register temporary timer handler to go off every 10 ms
register_int_handler(INT_APIC_TIMER, apic_timer_handler);
apic_timer(1000000);
}