Browse Source

Fix Intel cpus detection. Fix BUILD for new cloned repos. Changed ndnr() position for schedinit after test in real hw.

Elbing 8 years ago
parent
commit
ffdcbb8ade
6 changed files with 21 additions and 20 deletions
  1. 1 0
      BUILD
  2. 14 15
      sys/src/9/k10/archk10.c
  3. 3 3
      sys/src/9/k10/main.c
  4. 1 2
      sys/src/9/port/proc.c
  5. 1 0
      sys/src/cmd/kcmds.json
  6. 1 0
      sys/src/libc/klibc.json

+ 1 - 0
BUILD

@@ -163,6 +163,7 @@ else
 					printf "\n\nALL COMPONENTS COMPILED\n\n"
 					;;
 			"libs")
+					build_klibs
 					build_libs
 					;;
 			"klibs")

+ 14 - 15
sys/src/9/k10/archk10.c

@@ -75,15 +75,9 @@ cpuidhz(uint32_t *info0, uint32_t *info1)
 	int f, r;
 	int64_t hz;
 	uint64_t msr;
-/*	char *cp = info0[1];
-{int i; for(i =0; i < 12; i++) print("%c", cp[i]);}
-print("\n");*/
-//	print("NOTE: if cpuidhz runs too fast, we get die early with a NULL pointer\n");
-//	print("So, until that's fixed, we bring up AP cores slowly. Sorry!\n");
-//	See in main.c this message.
-//	return 0;
-
-	print("%s\n", (char *)&info0[1]);
+
+	//print("CPUID Vendor: %s\n", (char *)&info0[1]);
+	//print("CPUID Signature: %d\n", info1[0]);
 	if(memcmp(&info0[1], "GenuntelineI", 12) == 0){
 		switch(info1[0] & 0x0fff3ff0){
 		default:
@@ -129,15 +123,19 @@ print("\n");*/
 		case 0x000006e0:		/* Core Duo */
 		case 0x000006f0:		/* Core 2 Duo/Quad/Extreme */
 		case 0x00010670:		/* Core 2 Extreme */
+		case 0x000106e0:		/* i5 7xx */
+		case 0x00020650:		/* i5 6xx, i3 5xx */
+		case 0x000306c0:		/* i5 4xxx */
 		case 0x000006a0:		/* i7 paurea... */
 		case 0x000106a0:		/* i7 9xx */
-		case 0x000206a0:		/* i7 2xxx */
-		case 0x000306a0:		/* i7 3xxx */
+		case 0x000206a0:		/* i7 2xxx, i3 2xxx */
+		case 0x000306a0:		/* i7 3xxx, i5 3xxx, i3 4xxx */
 			/*
 			 * Get the FSB frequemcy.
 			 * If processor has Enhanced Intel Speedstep Technology
 			 * then non-integer bus frequency ratios are possible.
 			 */
+			//print("CPUID EIST: %d\n", (info1[2] & 0x00000080));
 			if(info1[2] & 0x00000080){
 				msr = rdmsr(0x198);
 				r = (msr>>40) & 0x1f;
@@ -146,9 +144,10 @@ print("\n");*/
 				msr = 0;
 				r = rdmsr(0x2a) & 0x1f;
 			}
-//iprint("r %d\n", r);
 			f = rdmsr(0xcd) & 0x07;
-//iprint("f %d\n", f);
+//iprint("rdmsr Intel: %d\n", rdmsr(0x2a));	
+//iprint("Intel msr.lo %d\n", r);
+//iprint("Intel msr.hi %d\n", f);
 			switch(f){
 			default:
 				return 0;
@@ -180,9 +179,9 @@ print("\n");*/
 			 * Do the scaling then round it.
 			 */
 			if(msr & 0x0000400000000000ll)
-				hz = hz*r + hz/2;
+				hz = hz*(r+10) + hz/2;
 			else
-				hz = hz*r;
+				hz = hz*(r+10);
 			hz = ((hz/100)+5)/10;
 			break;
 		}

+ 3 - 3
sys/src/9/k10/main.c

@@ -173,6 +173,9 @@ squidboy(int apicno, Mach *m)
 		 */
 		vsvminit(MACHSTKSZ, NIXTC, m);
 
+		/* Ready? steady? going to timer */
+		ndnr();
+
 		/*
 		 * Enable the timer interrupt.
 		 */
@@ -183,9 +186,6 @@ squidboy(int apicno, Mach *m)
 		adec(&active.nbooting);
 		ainc(&active.nonline);
 
-		/* Give thunderbirds a breath */
-		ndnr();
-
 		schedinit();
 		break;
 	}

+ 1 - 2
sys/src/9/port/proc.c

@@ -756,9 +756,8 @@ found:
 	 */
 	mp = p->wired;
 	if(mp != nil){
-		if(mp->proc != nil){
+		if(mp->proc != nil)
 			goto loop;
-		}
 	}else{
 		for(i = 0; i < MACHMAX; i++){
 			/*j = pickcore(p->color, i);

+ 1 - 0
sys/src/cmd/kcmds.json

@@ -25,6 +25,7 @@
 	"ls.c"
 	],
 	"Post": [
+	"[ -d $HARVEY/amd64/bin ] || mkdir $HARVEY/amd64/bin",
 	"mv bind $HARVEY/amd64/bin/",
 	"mv mount $HARVEY/amd64/bin/",
 	"mv date $HARVEY/amd64/bin/",

+ 1 - 0
sys/src/libc/klibc.json

@@ -269,6 +269,7 @@
 	],
 	"Post": [
 	"rm 9syscall/*.s",
+	"[ -d $HARVEY/amd64/lib ] || mkdir $HARVEY/amd64/lib",
 	"ar rv $HARVEY/amd64/lib/klibc.a *.o"
 	]
 }