projects
/
pintos-anon
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add more tests.
[pintos-anon]
/
src
/
devices
/
timer.c
diff --git
a/src/devices/timer.c
b/src/devices/timer.c
index 8f47c810ffc8af5a1c6804933fad710929450318..ecf6c5aacdfee97c6577c8b60912475ef99e4e77 100644
(file)
--- a/
src/devices/timer.c
+++ b/
src/devices/timer.c
@@
-7,6
+7,8
@@
#include "threads/io.h"
#include "threads/thread.h"
#include "threads/io.h"
#include "threads/thread.h"
+/* See [8254] for hardware details of the 8254 timer chip. */
+
#if TIMER_FREQ < 19
#error 8254 timer requires TIMER_FREQ >= 19
#endif
#if TIMER_FREQ < 19
#error 8254 timer requires TIMER_FREQ >= 19
#endif
@@
-64,9
+66,9
@@
timer_sleep (int64_t ticks)
{
int64_t start = timer_ticks ();
{
int64_t start = timer_ticks ();
+ ASSERT (intr_get_level () == INTR_ON);
while (timer_elapsed (start) < ticks)
while (timer_elapsed (start) < ticks)
- if (intr_get_level () == INTR_ON)
- thread_yield ();
+ thread_yield ();
}
/* Returns MS milliseconds in timer ticks, rounding up. */
}
/* Returns MS milliseconds in timer ticks, rounding up. */
@@
-98,7
+100,7
@@
timer_ns2ticks (int64_t ns)
void
timer_print_stats (void)
{
void
timer_print_stats (void)
{
- printf ("Timer: %"PRId64" ticks
.
\n", ticks);
+ printf ("Timer: %"PRId64" ticks\n", ticks);
}
\f
/* Timer interrupt handler. */
}
\f
/* Timer interrupt handler. */