Index: i386/isa/clock.c =================================================================== RCS file: /usr/cvs/src/sys/i386/isa/clock.c,v retrieving revision 1.222.2.2 diff -u -r1.222.2.2 clock.c --- i386/isa/clock.c 22 Aug 2006 16:52:42 -0000 1.222.2.2 +++ i386/isa/clock.c 29 Jun 2007 01:23:15 -0000 @@ -64,6 +64,7 @@ #include #include #include +#include #include #include #include @@ -288,7 +289,21 @@ int getit_calls = 1; int n1; static int state = 0; +#endif + + if (tsc_freq != 0 && !tsc_is_broken) { + uint64_t start, end, now; + sched_pin(); + start = rdtsc(); + end = start + (tsc_freq * n) / 1000000; + do { + now = rdtsc(); + } while (now < end || (now > start && end < start)); + sched_unpin(); + return; + } +#ifdef DELAYDEBUG if (state == 0) { state = 1; for (n1 = 1; n1 <= 10000000; n1 *= 10) Index: amd64/isa/clock.c =================================================================== RCS file: /usr/cvs/src/sys/amd64/isa/clock.c,v retrieving revision 1.221.2.1 diff -u -r1.221.2.1 clock.c --- amd64/isa/clock.c 18 Jul 2005 19:52:04 -0000 1.221.2.1 +++ amd64/isa/clock.c 29 Jun 2007 01:23:33 -0000 @@ -61,6 +61,7 @@ #include #include #include +#include #include #include #include @@ -269,7 +270,21 @@ int getit_calls = 1; int n1; static int state = 0; +#endif + + if (tsc_freq != 0 && !tsc_is_broken) { + uint64_t start, end, now; + sched_pin(); + start = rdtsc(); + end = start + (tsc_freq * n) / 1000000; + do { + now = rdtsc(); + } while (now < end || (now > start && end < start)); + sched_unpin(); + return; + } +#ifdef DELAYDEBUG if (state == 0) { state = 1; for (n1 = 1; n1 <= 10000000; n1 *= 10)