From 812383473cea9b53cf3c8ff138489a3d10d65f44 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sat, 11 Mar 2017 16:18:01 +0100 Subject: pc kernel: assume tsc and lapic clock rate on application processors is the same as on bootrap processor --- sys/src/9/pc/apic.c | 7 ++++++- sys/src/9/pc/i8253.c | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/src/9/pc/apic.c b/sys/src/9/pc/apic.c index 30ca0b50a..d061c777c 100644 --- a/sys/src/9/pc/apic.c +++ b/sys/src/9/pc/apic.c @@ -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 lapictimerinit(void) @@ -150,6 +150,11 @@ lapictimerinit(void) Apictimer *a; int s; + if(m->machno != 0){ + lapictimer[m->machno] = lapictimer[0]; + return; + } + s = splhi(); a = &lapictimer[m->machno]; a->tdx = 0; diff --git a/sys/src/9/pc/i8253.c b/sys/src/9/pc/i8253.c index 1163ace3c..50fad7105 100644 --- a/sys/src/9/pc/i8253.c +++ b/sys/src/9/pc/i8253.c @@ -130,6 +130,13 @@ guesscpuhz(int aalcycles) int loops, x, y; 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); for(loops = 1000;;loops += 1000) { /* -- cgit v1.2.3