This commit is contained in:
cinap_lenrek 2013-06-21 02:48:25 +02:00
commit 94fb78a65e
3 changed files with 14 additions and 19 deletions

View file

@ -519,5 +519,7 @@ identify(void)
return 1;
if((cp = getconf("*nomp")) != nil && strcmp(cp, "0") != 0)
return 1;
if(m->havetsc)
archacpi.fastclock = tscticks;
return 0;
}

View file

@ -395,5 +395,8 @@ identify(void)
return 1;
}
if(m->havetsc)
archmp.fastclock = tscticks;
return 0;
}

View file

@ -145,10 +145,12 @@ guesscpuhz(int aalcycles)
*
*/
outb(Tmode, Latch2);
cycles(&a);
x = inb(T2cntr);
x |= inb(T2cntr)<<8;
aamloop(loops);
outb(Tmode, Latch2);
cycles(&b);
y = inb(T2cntr);
y |= inb(T2cntr)<<8;
@ -172,25 +174,13 @@ guesscpuhz(int aalcycles)
cpufreq = (vlong)loops*((aalcycles*2*Freq)/x);
m->loopconst = (cpufreq/1000)/aalcycles; /* AAM+LOOP's for 1 ms */
if(m->havetsc){
aamloop(loops); /* warm up */
cycles(&a);
aamloop(loops);
cycles(&b);
aamloop(loops);
cycles(&a);
aamloop(loops);
cycles(&b);
/* a == b means virtualbox has confused us */
if(b > a){
b -= a;
b *= 2*Freq;
b /= x;
m->cyclefreq = b;
cpufreq = b;
}
/* a == b means virtualbox has confused us */
if(m->havetsc && b > a){
b -= a;
b *= 2*Freq;
b /= x;
m->cyclefreq = b;
cpufreq = b;
}
m->cpuhz = cpufreq;