*BSD News Article 39743


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!spool.mu.edu!uwm.edu!lll-winken.llnl.gov!decwrl!olivea!grapevine.lcs.mit.edu!ginger.lcs.mit.edu!wollman
From: wollman@ginger.lcs.mit.edu (Garrett A. Wollman)
Newsgroups: comp.os.386bsd.bugs
Subject: Re: FreeBSD 2.0
Date: 19 Dec 1994 18:24:59 GMT
Organization: MIT Laboratory for Computer Science
Lines: 41
Message-ID: <3d4j5r$5dn@GRAPEVINE.LCS.MIT.EDU>
References: <3cqt3e$3jl@ddi2.digital.net>
NNTP-Posting-Host: ginger.lcs.mit.edu

In article <3cqt3e$3jl@ddi2.digital.net>,
Eblan Farris  <efarris@digital.net> wrote:
>Why does FreeBSD 2.0 report my Pentium 90's speed rating low.
>
>When I boot up the FreeBSD 2.0 messages report speeds of anywhere
>between 75 and 85 MHz.
>
>Any info would be appreciated - especially if anyone knows exactly
>where FreeBSD is getting the info to report - or how does it 
>calculate it.

FreeBSD reads the Pentium cycle-counter register, waits for a second,
and reads it again, then divides the difference by a million to
determine the speed in MHz.  The code to do this is in
/sys/i386/isa/clock.c (the appropriateness of the location is
debatable), in the function calibrate_cyclecounter().  This code has a
bug in it (which I think was introduced while trying to work around a
faulty version of gcc):


        cycles_per_sec = (long long)edx + eax;
        cycles_per_sec -= (long long)lastedx + lasteax;

which should say:

	cycles_per_sec = (long long)edx << 32 + eax;
	cycles_per_sec -= (long long)lastedx << 32 + lasteax;

Try this and let me know if it fixes things.

Another possibility may be that the DELAY routine is somehow
calibrated incorrectly for your hardware, or you have a really, really
bad oscillator in your machine.

-GAWollman

-- 
Garrett A. Wollman   | Shashish is simple, it's discreet, it's brief. ... 
wollman@lcs.mit.edu  | Shashish is the bonding of hearts in spite of distance.
Opinions not those of| It is a bond more powerful than absence.  We like people
MIT, LCS, ANA, or NSA| who like Shashish.  - Claude McKenzie + Florent Vollant