make loop counter volatile to prevent gcc4.1 from optimizing away entire loop body
[pintos-anon] / src / devices / timer.c
index 24eede0e247e8c1f389be38f129dda96d81ffb80..070c487328a61e10a8e6a86390703f4dd289173b 100644 (file)
@@ -123,7 +123,7 @@ timer_nsleep (int64_t ns)
 void
 timer_print_stats (void) 
 {
-  printf ("Timer: %"PRId64" ticks\n", ticks);
+  printf ("Timer: %"PRId64" ticks\n", timer_ticks ());
 }
 \f
 /* Timer interrupt handler. */
@@ -162,7 +162,7 @@ too_many_loops (unsigned loops)
    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;