ソースを参照

allow precise GC to run on 32-bit Windows;
rebuilt the release

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@6795 8c9fc860-2736-0410-a75d-ab315db34111

eth.morozova 9 年 前
コミット
bc8b6e9a5b
4 ファイル変更16 行追加9 行削除
  1. BIN
      WinAos/A2.exe
  2. BIN
      WinAos/obg/Objects.GofW
  3. 2 0
      WinAos/obg/Objects.SymW
  4. 14 9
      source/Win32.Objects.Mod

BIN
WinAos/A2.exe


BIN
WinAos/obg/Objects.GofW


+ 2 - 0
WinAos/obg/Objects.SymW

@@ -145,7 +145,9 @@ VAR
 	nProcs: LONGINT; 
 	excplock: Kernel32.CriticalSection; 
 	exceptionhandler: ExceptionHandler; 
+	isWow64: BOOLEAN; 
 	GetProcedureName*: PROCEDURE (pc: ADDRESS; VAR n: ARRAY OF CHAR; VAR spc: ADDRESS); 
+	lpContext: Kernel32.Wow64Context; 
 
 	PROCEDURE ^ SetPriority*(priority: LONGINT); 
 	PROCEDURE ^ LockedByCurrent*(obj: ANY): BOOLEAN; 

+ 14 - 9
source/Win32.Objects.Mod

@@ -176,7 +176,7 @@ TYPE
 				sp := Machine.CurrentSP();  bp :=Machine.CurrentBP(); pc := Machine.CurrentPC(); 
 			ELSE
 				IF mode # Suspended THEN
-					IF Kernel32.Wow64SuspendThread # NIL THEN 
+					IF isWow64 THEN 
 						res := Kernel32.Wow64SuspendThread(handle);
 					ELSE
 						res := Kernel32.SuspendThread(handle);
@@ -188,7 +188,7 @@ TYPE
 				res := Kernel32.GetThreadContext( handle, state );
 				
 				context.ContextFlags := Kernel32.ContextControl + Kernel32.ContextInteger;
-				IF Kernel32.Wow64GetThreadContext # NIL THEN 
+				IF isWow64 THEN 
 					res := Kernel32.Wow64GetThreadContext( handle, context );
 				ELSE
 					res := Kernel32.GetThreadContext( handle, context );
@@ -274,7 +274,7 @@ TYPE
 				WHILE p # NIL DO
 					cur := p(Process);
 					IF ((cur.mode = Ready) OR (cur.mode = Running)) & (cur.priority <= High) & (cur # r) THEN
-						IF Kernel32.Wow64SuspendThread # NIL THEN 
+						IF isWow64 THEN 
 							res := Kernel32.Wow64SuspendThread(cur.handle);
 						ELSE
 							res := Kernel32.SuspendThread(cur.handle);
@@ -379,6 +379,8 @@ VAR
 	nProcs: LONGINT;
 
 	excplock: Kernel32.CriticalSection;  exceptionhandler: ExceptionHandler;
+	
+	isWow64: BOOLEAN; (* TRUE for WOW64 environment *)
 
 (* Set the current process' priority. *)
 PROCEDURE SetPriority*( priority: LONGINT );
@@ -1040,7 +1042,7 @@ END Await;
 		IF CurrentProcess() # t THEN
 			Machine.Acquire( Machine.Objects );
 			LOOP
-				IF Kernel32.Wow64SuspendThread # NIL THEN 
+				IF isWow64 THEN 
 					retBOOL := Kernel32.Wow64SuspendThread(t.handle);
 				ELSE
 					retBOOL := Kernel32.SuspendThread( t.handle );
@@ -1286,6 +1288,9 @@ BEGIN
 	END;	
 END ReenterA2;
 
+VAR
+	lpContext: Kernel32.Wow64Context;
+	
 BEGIN
 	exceptionhandler := NIL;
 	terminateProc := TerminateProc;
@@ -1293,11 +1298,11 @@ BEGIN
 	tlsIndex := Kernel32.TlsAlloc();
 	ASSERT ( tlsIndex # Kernel32.TLSOutOfIndexes );
 	Kernel32.SendToDebugger("Modules.root", ADDRESSOF(Modules.root));
-	IF Kernel32.Wow64GetThreadContext # NIL THEN
-		Trace.String("Use Wow64 Context"); Trace.Ln;
-	END;
-	IF Kernel32.Wow64SuspendThread # NIL THEN
-		Trace.String("Use Wow64 suspend"); Trace.Ln;
+	
+	(* determine whether it is WOW64 environment *)
+	isWow64 := Kernel32.Wow64GetThreadContext(Kernel32.GetCurrentThread(),lpContext) # 0; 
+	IF isWow64 THEN
+		Trace.String("Use Wow64"); Trace.Ln;
 	END;
 	Init
 END Objects.