projects
/
pintos-anon
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4d1950a
)
Make sure loops_per_tick doesn't overflow to zero.
author
Ben Pfaff
<blp@cs.stanford.edu>
Sat, 11 Nov 2006 14:19:40 +0000
(14:19 +0000)
committer
Ben Pfaff
<blp@cs.stanford.edu>
Sat, 11 Nov 2006 14:19:40 +0000
(14:19 +0000)
src/devices/timer.c
patch
|
blob
|
history
diff --git
a/src/devices/timer.c
b/src/devices/timer.c
index 070c487328a61e10a8e6a86390703f4dd289173b..662e0c6f5645be139fde64f9f300bcd0f17d9c52 100644
(file)
--- a/
src/devices/timer.c
+++ b/
src/devices/timer.c
@@
-57,8
+57,11
@@
timer_calibrate (void)
/* Approximate loops_per_tick as the largest power-of-two
still less than one timer tick. */
loops_per_tick = 1u << 10;
- while (!too_many_loops (loops_per_tick << 1))
- loops_per_tick <<= 1;
+ while (!too_many_loops (loops_per_tick << 1))
+ {
+ loops_per_tick <<= 1;
+ ASSERT (loops_per_tick != 0);
+ }
/* Refine the next 8 bits of loops_per_tick. */
high_bit = loops_per_tick;