فهرست منبع

implemented a workaround for a problem when the CPU1 does not wake up at a call of SEV instruction

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@8594 8c9fc860-2736-0410-a75d-ab315db34111
eth.morozova 6 سال پیش
والد
کامیت
63423f36f4
1فایلهای تغییر یافته به همراه25 افزوده شده و 5 حذف شده
  1. 25 5
      source/ARM.Machine.Mod

+ 25 - 5
source/ARM.Machine.Mod

@@ -1114,11 +1114,18 @@ VAR
 	BEGIN
 	END StartAll;
 
+	(* Send event instruction *)
+	PROCEDURE -Sev;
+	CODE
+		SEV
+	END Sev;
+
 	(** Start core id on procedure p. *)
 	PROCEDURE StartProcessor(id: LONGINT; p: PROCEDURE);
 	VAR
-		time: LONGINT;
+		time, ticks0: LONGINT;
 		started: BOOLEAN;
+		sevCount: SIZE;
 	BEGIN
 		IF traceCpus THEN
 			Acquire(TraceOutput);
@@ -1129,18 +1136,31 @@ VAR
 			Trace.Ln;
 			Release(TraceOutput)
 		END;
-		time := ticks + 5000;
 		Initializer.secondaryProcId := id;
 		Initializer.secondaryBootProc :=  SYSTEM.VAL(ADDRESS, p);
 		FlushDCacheRange(ADDRESSOF(Initializer.secondaryProcId), 4);
 		FlushDCacheRange(ADDRESSOF(Initializer.secondaryBootProc), 4);
-		CODE
-			SEV
-		END;
 
+		(* wake up the other cores *)
+		Sev;
+
+		time := ticks + 1000;
+		sevCount := 0;
+		ticks0 := ticks;
 		REPEAT
 			started := id IN allProcessors;
+			(*! a workaround for rare but nevertheless occurring case when the other CPU does not wake up  *)
+			IF ~started & (ticks - ticks0 > 1) THEN
+				Sev;
+				ticks0 := ticks;
+				INC(sevCount);
+			END;
 		UNTIL started OR (time <= ticks);
+		IF traceCpus THEN
+			Acquire(TraceOutput);
+			Trace.String("SEV call count="); Trace.Int(sevCount,0); Trace.Ln;
+			Release(TraceOutput);
+		END;
 		IF id IN allProcessors THEN
 			IF traceCpus THEN
 				Acquire(TraceOutput);