- this_timer->low_bits = 0;
- this_timer->high_bits = 0;
- this_timer->tstamp = 0;
- this_timer->high_bits_check = 0;
-}
-
-#if STAT_TIME
-#else /* STAT_TIME */
-
-#ifdef MACHINE_TIMER_ROUTINES
-
-/*
- * Machine-dependent code implements the timer routines.
- */
-
-#else /* MACHINE_TIMER_ROUTINES */
-
-/*
- * start_timer starts the given timer for this cpu. It is called
- * exactly once for each cpu during the boot sequence.
- */
-void
-start_timer(
- register timer_t timer)
-{
- timer->tstamp = get_timestamp();
- mp_disable_preemption();
- current_timer[cpu_number()] = timer;
- mp_enable_preemption();
-}
-
-/*
- * time_trap_uentry does trap entry timing. Caller must lock out
- * interrupts and take a timestamp. ts is a timestamp taken after
- * interrupts were locked out. Must only be called if trap was
- * from user mode.
- */
-void
-time_trap_uentry(
- unsigned ts)
-{
- int elapsed;
- int mycpu;
- timer_t mytimer;
-
- mp_disable_preemption();
-
- /*
- * Calculate elapsed time.
- */
- mycpu = cpu_number();
- mytimer = current_timer[mycpu];
- elapsed = ts - mytimer->tstamp;
-#ifdef TIMER_MAX
- if (elapsed < 0) elapsed += TIMER_MAX;
-#endif /* TIMER_MAX */
-
- /*
- * Update current timer.
- */
- mytimer->low_bits += elapsed;
- mytimer->tstamp = 0;
-
- if (mytimer->low_bits & TIMER_LOW_FULL) {
- timer_normalize(mytimer);
- }
-
- /*
- * Record new timer.
- */
- mytimer = &(current_thread()->system_timer);
- current_timer[mycpu] = mytimer;
- mytimer->tstamp = ts;
-
- mp_enable_preemption();
-}
-
-/*
- * time_trap_uexit does trap exit timing. Caller must lock out
- * interrupts and take a timestamp. ts is a timestamp taken after
- * interrupts were locked out. Must only be called if returning to
- * user mode.
- */
-void
-time_trap_uexit(
- unsigned ts)
-{
- int elapsed;
- int mycpu;
- timer_t mytimer;
-
- mp_disable_preemption();
-
- /*
- * Calculate elapsed time.
- */
- mycpu = cpu_number();
- mytimer = current_timer[mycpu];
- elapsed = ts - mytimer->tstamp;
-#ifdef TIMER_MAX
- if (elapsed < 0) elapsed += TIMER_MAX;
-#endif /* TIMER_MAX */
-
- /*
- * Update current timer.
- */
- mytimer->low_bits += elapsed;
- mytimer->tstamp = 0;
-
- if (mytimer->low_bits & TIMER_LOW_FULL) {
- timer_normalize(mytimer); /* SYSTEMMODE */
- }
-
- mytimer = &(current_thread()->user_timer);
-
- /*
- * Record new timer.
- */
- current_timer[mycpu] = mytimer;
- mytimer->tstamp = ts;
-
- mp_enable_preemption();