From 26f79d5608fe5cf867559fef95d4ccdaaca1a994 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Thu, 18 Aug 2011 17:14:20 +0200 Subject: Add compiler barrier to update_mapped_time * kern/mach_clock.c (update_mapped_time): Add compiler barriers between writes to shared memory. Update comment: on SMP, write barriers are required. --- kern/mach_clock.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kern/mach_clock.c b/kern/mach_clock.c index 04a3115..4ba7c08 100644 --- a/kern/mach_clock.c +++ b/kern/mach_clock.c @@ -91,7 +91,7 @@ int bigadj = 1000000; /* adjust 10*tickadj if adjustment * } while (secs != mtime->check_seconds); * to read the time correctly. (On a multiprocessor this assumes * that processors see each other's writes in the correct order. - * We may have to insert fence operations.) + * We have to insert write fence operations.) FIXME */ mapped_time_value_t *mtime = 0; @@ -100,7 +100,9 @@ mapped_time_value_t *mtime = 0; MACRO_BEGIN \ if (mtime != 0) { \ mtime->check_seconds = (time)->seconds; \ + asm volatile("":::"memory"); \ mtime->microseconds = (time)->microseconds; \ + asm volatile("":::"memory"); \ mtime->seconds = (time)->seconds; \ } \ MACRO_END -- cgit v1.2.3