pc kernel: assume tsc and lapic clock rate on application processors is the same as on bootrap processor

This commit is contained in:
cinap_lenrek 2017-03-11 16:18:01 +01:00
parent 3e0e77a852
commit 812383473c
2 changed files with 13 additions and 1 deletions

View file

@ -141,7 +141,7 @@ lapiconline(void)
} }
/* /*
* use the i8253 clock to figure out our lapic timer rate. * use the i8253/tsc clock to figure out our lapic timer rate.
*/ */
static void static void
lapictimerinit(void) lapictimerinit(void)
@ -150,6 +150,11 @@ lapictimerinit(void)
Apictimer *a; Apictimer *a;
int s; int s;
if(m->machno != 0){
lapictimer[m->machno] = lapictimer[0];
return;
}
s = splhi(); s = splhi();
a = &lapictimer[m->machno]; a = &lapictimer[m->machno];
a->tdx = 0; a->tdx = 0;

View file

@ -130,6 +130,13 @@ guesscpuhz(int aalcycles)
int loops, x, y; int loops, x, y;
uvlong a, b, cpufreq; uvlong a, b, cpufreq;
if(m->machno != 0){
m->cpuhz = MACHP(0)->cpuhz;
m->cpumhz = MACHP(0)->cpumhz;
m->loopconst = MACHP(0)->loopconst;
return;
}
ilock(&i8253); ilock(&i8253);
for(loops = 1000;;loops += 1000) { for(loops = 1000;;loops += 1000) {
/* /*