The k project



The time manager handles time intervals in the kernel. This driver does not provide real date and time calculation routines. It is rather used as a rate generator, to wake the kernel up at accurate intervals of time, mesured in ticks. In k we will use the 8254 PIT.

Syscall interface

    gettick - get the time
    unsigned long gettick(void);
    gettick() returns the number of milliseconds elapsed since the machine started.
    gettick() returns the time in milliseconds.

PIT programming

Since we only need a periodic source of interrupt to implement the gettick() syscall, we will use the Mode 2 of the 8254 on the Counter 0, with an interrupt rate of 100Hz. The interrupt handler will just increment a global variable on each interrupt: the number of tick since the machine started.

Possible bug causes