summaryrefslogtreecommitdiff
path: root/kern/mach_clock.c
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2015-09-07 14:37:40 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2015-09-07 14:59:29 +0200
commit2b4c03cbc84090174a3cf5d27887bac8fb052b57 (patch)
tree5765297bc0b861b53526cbed3fb9d2257c456d90 /kern/mach_clock.c
parent48b94c74e9817781a1e7a4fdd03fa471953047fb (diff)
kern: fix loop reading the time value
Previously, recent versions of gcc would hoist the loads out of the loop reading the time value. * kern/macros.h (access_once): New macro. * kern/mach_clock.c (host_get_time): Use the new macro to prevent the loads from being hoisted out of the loop.
Diffstat (limited to 'kern/mach_clock.c')
-rw-r--r--kern/mach_clock.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/kern/mach_clock.c b/kern/mach_clock.c
index 655adf4..2bcd232 100644
--- a/kern/mach_clock.c
+++ b/kern/mach_clock.c
@@ -426,9 +426,9 @@ host_get_time(host, current_time)
return(KERN_INVALID_HOST);
do {
- current_time->seconds = mtime->seconds;
- current_time->microseconds = mtime->microseconds;
- } while (current_time->seconds != mtime->check_seconds);
+ current_time->seconds = access_once(mtime->seconds);
+ current_time->microseconds = access_once(mtime->microseconds);
+ } while (current_time->seconds != access_once(mtime->check_seconds));
return (KERN_SUCCESS);
}