shithub: riscv

Download patch

ref: 812383473cea9b53cf3c8ff138489a3d10d65f44
parent: 3e0e77a8521331412c96b6371622aa2f76d7aefc
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Mar 11 11:18:01 EST 2017

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

--- a/sys/src/9/pc/apic.c
+++ b/sys/src/9/pc/apic.c
@@ -141,7 +141,7 @@
 }
 
 /*
- *  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)
@@ -149,6 +149,11 @@
 	uvlong x, v, hz;
 	Apictimer *a;
 	int s;
+
+	if(m->machno != 0){
+		lapictimer[m->machno] = lapictimer[0];
+		return;
+	}
 
 	s = splhi();
 	a = &lapictimer[m->machno];
--- a/sys/src/9/pc/i8253.c
+++ b/sys/src/9/pc/i8253.c
@@ -130,6 +130,13 @@
 	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) {
 		/*