Browse Source

Adjusted Windows.Objects modules

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@8215 8c9fc860-2736-0410-a75d-ab315db34111
negelef 7 years ago
parent
commit
07f4ac6d91
2 changed files with 14 additions and 25 deletions
  1. 2 2
      source/Windows.AMD64.Objects.Mod
  2. 12 23
      source/Windows.I386.Objects.Mod

+ 2 - 2
source/Windows.AMD64.Objects.Mod

@@ -122,7 +122,7 @@ TYPE
 	Win32Event = Kernel32.HANDLE;
 	
 	GCContext = RECORD
-		nextPos: LONGINT; (* 0 to start with *)
+		nextPos: SIZE; (* 0 to start with *)
 		(*first,*)  last: ARRAY 256 OF ADDRESS; (* first might be not required *)
 	END;
 
@@ -161,7 +161,7 @@ TYPE
 			modName: ARRAY 128 OF CHAR;
 			mode0,mode1: LONGINT;
 			
-			contextPos: LONGINT;
+			contextPos: SIZE;
 		BEGIN{UNCHECKED} (* avoid winapi call indirection *)
 			O := obj; ID := id;
 			IF (handle = 0) OR (mode = Terminated) OR (mode < Ready) (* procedure Wrapper not yet started *)

+ 12 - 23
source/Windows.I386.Objects.Mod

@@ -130,41 +130,29 @@ TYPE
 		rootedNext : Process; (*  to prevent process to be GCed in WinAos *)
 		obj-: ProtectedObject;   (* associated active object *)
 		state-: Kernel32.Context;
-		(*
-		sse: SSEState;	(* fpu and sse state of preempted process (only valid if Preempted IN flag) *)
-		sseAdr: LONGINT;
-		*)
 		condition-: Condition;   (* awaited process' condition *)
-		condFP-: LONGINT;   (* awaited process' condition's context *)
+		condFP-: ADDRESS;   (* awaited process' condition's context *)
 		mode-: LONGINT;   (* process state *)  (* only changed inside Objects lock ??? *)
 		procID-: LONGINT;   (* processor ID where running,  exported for compatibilty , useless in WinAos *)
 		waitingOn-: ProtectedObject;   (* obj this process is waiting on (for lock or condition) *)
 		id-: LONGINT;   (* unique process ID for tracing *)
 		flags*: SET;   (* process flags *)
 		priority-: LONGINT;   (* process priority *)
-		(*
-		currPri: LONGINT;
-		stack*: Machine.Stack; (** user-level stack of process *)
-		*)
-		stackBottom: LONGINT;
+
+		stackBottom: ADDRESS;
 		handle-: Kernel32.HANDLE; (* handle to corresponding Windows thread *)
 		body: Body;
 		event: Win32Event;
-		restartPC-: LONGINT;   (** entry point of body, for SAFE exception recovery *)
-		restartSP-: LONGINT;   (** stack level at start of body, for SAFE exception recovery *)
-		(*
-		perfCyc*: ARRAY Machine.MaxCPU OF HUGEINT;
-		priInvCnt: LONGINT; (* counts the nummber of object locks hold that increased currPri of the process *)
-		exp*: Machine.ExceptionState;
-		oldReturnPC: LONGINT;
-		*)
+		restartPC-: ADDRESS;   (** entry point of body, for SAFE exception recovery *)
+		restartSP-: ADDRESS;   (** stack level at start of body, for SAFE exception recovery *)
+
 		lastThreadTimes: HUGEINT;   (*ALEX 2005.12.12*)
 		gcContext: GCContext;
 		context: ANY; (* commands contect *)
 
 		PROCEDURE FindRoots*;   (* override, called while GC, replaces Threads.CheckStacks *)
 		VAR sp: ADDRESS; res: Kernel32.BOOL; pc, bp: ADDRESS;
-			n,adr: ADDRESS; desc {UNTRACED}: Modules.ProcedureDescPointer; i: LONGINT; p {UNTRACED}: ANY;
+			n,adr: ADDRESS; desc {UNTRACED}: Modules.ProcedureDescPointer; p {UNTRACED}: ANY; i: SIZE;
 			context: Kernel32.Wow64Context;
 			a0,a1, obp, osb, osbp, opc, gbp: ADDRESS;
 			O: ANY; ID: LONGINT;
@@ -746,7 +734,7 @@ BEGIN
 END terminate;
 
 PROCEDURE {WINAPI} Wrapper( lpParameter: ANY ): LONGINT;
-VAR t: Process;  obj: ProtectedObject; res: Kernel32.BOOL; bp,sp: LONGINT;
+VAR t: Process;  obj: ProtectedObject; res: Kernel32.BOOL; bp,sp: ADDRESS;
 	excpfrm: Kernel32.ExcpFrm;
 BEGIN
 	(* it may happen that the garbage collector runs right here and ignores this procedure.
@@ -764,8 +752,8 @@ BEGIN
 	sp := Machine.CurrentSP();
 	t.restartSP := sp;
 	t.stackBottom := bp;
-	IF t.restartPC = SYSTEM.VAL(ADDRESS, terminateProc) THEN DEC(t.restartSP, 4)
-	ELSE DEC(t.restartSP, 8)
+	IF t.restartPC = SYSTEM.VAL(ADDRESS, terminateProc) THEN DEC(t.restartSP, SIZEOF(ADDRESS))
+	ELSE DEC(t.restartSP, 2*SIZEOF(ADDRESS))
 	END;
 	IF TraceVerbose THEN
 		Machine.Acquire(Machine.TraceOutput);
@@ -876,11 +864,12 @@ VAR t : Process; heapBlock {UNTRACED}: Heaps.HeapBlock;
 BEGIN
 	ASSERT(priority >= 0, 1000); ASSERT(priority <=Realtime, 1001);
 	SYSTEM.GET(SYSTEM.VAL(ADDRESS, obj) + Heaps.HeapBlockOffset, heapBlock);
+	
 	ASSERT(heapBlock IS Heaps.ProtRecBlock); (* protected object *)
 	IF Restart IN flags THEN INCL(flags, Resistant) END;   (* SAFE => Restart & Resistant *)
 	NewProcess(body, priority, flags, obj, t);  INC(nProcs);  (* acquires Machine.Objects lock *)
 	t.mode := Ready; Put(ready, t);
-	Machine.Release(Machine.Objects)
+	Machine.Release(Machine.Objects);
 END CreateProcess;