From fd832a3bbb39e99039c15c4ddf09873969395cbc Mon Sep 17 00:00:00 2001 From: Matt Macy Date: Fri, 26 Oct 2018 03:35:33 -0700 Subject: [PATCH] try to ensure that gcc doesn't try to optimize the DELAY loop --- sys/powerpc/powerpc/clock.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/powerpc/powerpc/clock.c b/sys/powerpc/powerpc/clock.c index 890ce6616f53b..9db18788f1a78 100644 --- a/sys/powerpc/powerpc/clock.c +++ b/sys/powerpc/powerpc/clock.c @@ -303,13 +303,16 @@ decr_get_timecount(struct timecounter *tc) void DELAY(int n) { - u_quad_t tb, ttb; + volatile u_quad_t tb, ttb; TSENTER(); tb = mftb(); ttb = tb + howmany((uint64_t)n * 1000000, ps_per_tick); - while (tb < ttb) + while (tb < ttb) { + __compiler_membar(); tb = mftb(); + __compiler_membar(); + } TSEXIT(); }