summaryrefslogtreecommitdiff
path: root/sys/arch/i386/isa/clock.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/i386/isa/clock.c')
-rw-r--r--sys/arch/i386/isa/clock.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/arch/i386/isa/clock.c b/sys/arch/i386/isa/clock.c
index 5cacb8cc9fc..2833d2f2f10 100644
--- a/sys/arch/i386/isa/clock.c
+++ b/sys/arch/i386/isa/clock.c
@@ -107,6 +107,10 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
void spinwait __P((int));
+#ifdef I586_CPU
+int pentium_mhz;
+#endif
+
#define SECMIN ((unsigned)60) /* seconds per minute */
#define SECHOUR ((unsigned)(60*SECMIN)) /* seconds per hour */
#define SECDAY ((unsigned)(24*SECHOUR)) /* seconds per day */
@@ -303,6 +307,19 @@ findcpuspeed()
delaycount = (FIRST_GUESS * TIMER_DIV(1000)) / (0xffff-remainder);
}
+#ifdef I586_CPU
+void
+calibrate_cyclecounter()
+{
+ unsigned long long count, last_count;
+
+ __asm __volatile(".byte 0xf, 0x31" : "=A" (last_count));
+ delay(1000000);
+ __asm __volatile(".byte 0xf, 0x31" : "=A" (count));
+ pentium_mhz = ((count - last_count) + 500000) / 1000000;
+}
+#endif
+
void
cpu_initclocks()
{