Sync/arch/i386/sys_clock.c
Curle 4edd4b7cc8 Major refactor. Major improvements.
All ISR/IRQ stuff moved into its own header and source.

Comments added on all major parts.

Some optimisations in important functions.

All ASM removed for ISR and IRQ, instead using new GCC directives.
2019-06-27 19:57:54 +01:00

26 lines
497 B
C
Executable File

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