#error TIMER_FREQ <= 1000 recommended
#endif
-/* Number of time ticks to elapse between process yields. */
-#define TIME_SLICE 1
-
/* Number of timer ticks since OS booted. */
static volatile int64_t ticks;
outb (0x40, count & 0xff);
outb (0x40, count >> 8);
- intr_register (0x20, 0, INTR_OFF, timer_interrupt, "8254 Timer");
+ intr_register_ext (0x20, timer_interrupt, "8254 Timer");
}
/* Calibrates loops_per_tick, used to implement brief delays. */
void
timer_print_stats (void)
{
- printf ("Timer: %"PRId64" ticks\n", ticks);
+ printf ("Timer: %"PRId64" ticks\n", timer_ticks ());
}
\f
/* Timer interrupt handler. */
{
ticks++;
thread_tick ();
- if (ticks % TIME_SLICE == 0)
- intr_yield_on_return ();
}
/* Returns true if LOOPS iterations waits for more than one timer
differently in different places the results would be difficult
to predict. */
static void NO_INLINE
-busy_wait (int64_t loops)
+busy_wait (volatile int64_t loops)
{
while (loops-- > 0)
continue;