Syncboot/arch/uefi/sys_clock.c
Curle 8f0de18b37 Begin transition to UEFI.
The current system of separating x86 and x86_64 is no longer
feasible with UEFI implementation. UEFI must have its own entry point.

To this end, some optimisations have been implemented in the ASM files.
Everything related to setup has been removed, leaving only the IDT and GDT utility functions.

The linker may be required for the other files, though.
2019-07-17 15:08:47 +01:00

35 lines
687 B
C

/************************
*** Team Kitty, 2019 ***
*** Sync ***
***********************/
/* This file provides an interface to
* the hardware timer / RTC. Not much
* more to be said about it. */
#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);
}