Sync/arch/i386/sys_clock.c
Jenny Curle 31d2e10b69 Implement a GDT, IDT with ISR and IRQ
Basically, added error handling, interrupts and basic hardware communication is now possible. Yay.
2019-04-07 23:43:09 +01:00

21 lines
412 B
C
Executable File

#include <kernel/utils.h>
#include <kernel/descriptor_tables.h>
#include <kernel/serial.h>
size_t timer_ticks = 0;
size_t flag = 0;
void timer_handler(registers_t* r) {
timer_ticks++;
if(timer_ticks % 18 == 0) {
if(++flag % 2 == 0) {
serial_print(0x3F8, "Tick.");
} else {
serial_print(0x3F8, "Tock.");
}
}
}
void timer_install() {
irq_install_handler(0, timer_handler);
}