From 38296ea0eb4d6210c6567532692d1b8ff91ed1d9 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Wed, 10 Mar 1999 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1999-03-10 --- pc/clock.c | 2 ++ pc/mp.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pc/clock.c b/pc/clock.c index a036d7efd41ee324490a55f963cca8e2a0347869..7d14d6487b6689e495ff47bfa9134d8a8be957e1 100644 --- a/pc/clock.c +++ b/pc/clock.c @@ -38,6 +38,8 @@ clockintr(Ureg* ureg, void*) { Clock0link *lp; + // this needs to be here for synchronizing mp clocks + // see mp.c's squidboy() fastticks(nil); m->ticks++; if(m->proc) diff --git a/pc/mp.c b/pc/mp.c index c7fafbe14c057ea94edb3caa27a1da5a90c70e97..2196a80e925c6b676bfddceb8466d7070846e945 100644 --- a/pc/mp.c +++ b/pc/mp.c @@ -351,6 +351,8 @@ checkmtrr(void) static void squidboy(Apic* apic) { + ulong x; + // iprint("Hello Squidboy\n"); machinit(); @@ -367,8 +369,12 @@ squidboy(Apic* apic) /* * Restrain your octopus! Don't let it go out on the sea! */ - while(MACHP(0)->ticks == 0) - wrmsr(0x10, MACHP(0)->fastclock); /* synchronize fast counters */ + lock(&active); + x = MACHP(0)->ticks; + while(MACHP(0)->ticks == x) + ; + wrmsr(0x10, MACHP(0)->fastclock); /* synchronize fast counters */ + unlock(&active); lapicinit(apic); lapiconline();