浏览代码

Preliminary patches for EFI 64-bit. Alignment issues require further consideration.
EFI not yet published.


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

felixf 9 年之前
父节点
当前提交
9802c8ed33
共有 2 个文件被更改,包括 51 次插入6 次删除
  1. 14 3
      source/FoxIntermediateBackend.Mod
  2. 37 3
      source/Generic.Modules.Mod

+ 14 - 3
source/FoxIntermediateBackend.Mod

@@ -10947,6 +10947,14 @@ TYPE
 			section.Emit(Data(-1,op));
 		END Longint;
 
+		PROCEDURE PatchAddress(section: IntermediateCode.Section; pc: LONGINT; value: LONGINT);
+		VAR op,noOperand: IntermediateCode.Operand;
+		BEGIN
+			IntermediateCode.InitOperand(noOperand);
+			IntermediateCode.InitImmediate(op,IntermediateCode.GetType(module.system, module.system.addressType),value);
+			section.PatchOperands(pc,op,noOperand,noOperand);
+		END PatchAddress;
+
 		PROCEDURE PatchLongint(section: IntermediateCode.Section; pc: LONGINT; value: LONGINT);
 		VAR op,noOperand: IntermediateCode.Operand;
 		BEGIN
@@ -11315,6 +11323,8 @@ TYPE
 				Basic.InitSegmentedName(prev);
 				olevel := -1;
 				scopes[0].section := source;
+				scopes[0].arraySizePC := MIN(LONGINT);
+				
 
 				FOR s := 0 TO LEN(sections)-1 DO
 					symbol := sections[s];
@@ -11378,9 +11388,10 @@ TYPE
 					DEC(olevel); 
 				END;
 				
+
 				level := 0;
 				WHILE (level < LEN(scopes)) DO
-					IF scopes[level].section # NIL THEN
+					IF (scopes[level].section # NIL) & (scopes[level].arraySizePC # MIN(LONGINT))  THEN
 						PatchArray(scopes[level].section, scopes[level].arraySizePC, scopes[level].gelements);
 					END;
 					INC(level);
@@ -12170,20 +12181,20 @@ TYPE
 			Symbol(moduleSection,referenceSection,referenceSectionOffset,0);
 			Info(moduleSection, "export*: ExportDesc");
 			ExportDesc(moduleSection);
+			IF module.system.addressType.sizeInBits = 64 THEN Longint(moduleSection, 0) END;
 			Info(moduleSection, "term*: TerminationHandler");
 			Address(moduleSection,0);
 			Info(moduleSection, "exTable*: ExceptionTable");
 			Symbol(moduleSection,exceptionSection,exceptionSectionOffset,0);
 			Info(moduleSection, "noProcs*: LONGINT");
 			Longint(moduleSection,numberProcs);
+			IF module.system.addressType.sizeInBits = 64 THEN Longint(moduleSection, 0); Longint(moduleSection,0); END;
 			Info(moduleSection, "firstProc*: ADDRESS");
 			Address(moduleSection,0);
 			Info(moduleSection, "maxPtrs*: LONGINT");
 			Longint(moduleSection,maxPointers);
 			Info(moduleSection, "crc*: LONGINT");
 			Longint(moduleSection, 0); (*!  must be implemented *)
-
-
 			Info(moduleSection, "body*: ADDRESS");
 			Symbol(moduleSection, bodyProc, 0,0);
 

+ 37 - 3
source/Generic.Modules.Mod

@@ -29,7 +29,7 @@ CONST
 	DefaultContext* = "A2";
 	NoLoader=3400;
 
-	TraceBoot=FALSE;
+	TraceBoot=TRUE;
 
 TYPE
 	(* definitions for object-model loader support *)
@@ -44,7 +44,7 @@ TYPE
 	END;
 
 	ExportDesc* = RECORD
-		fp*: ADDRESS;
+		fp*: LONGINT;
 		name* {UNTRACED}: DynamicName;
 		adr*: ADDRESS;
 		exports*: LONGINT;
@@ -325,6 +325,7 @@ VAR callagain: BOOLEAN;
 PROCEDURE Initialize0*(module: Module);
 VAR new: BOOLEAN;
 BEGIN
+	TRACE(module.name);
 	(* module MUST have been removed from register list and must not have been initialized yet *)
 	ASSERT(module.next = NIL);
 	Publish (module, new);
@@ -334,6 +335,37 @@ BEGIN
 			callagain := TRUE;
 			module.init := TRUE;
 		END;
+		Trace.Memory(SYSTEM.VAL(ADDRESS, module), 256);
+		TRACE(module, module.name, module.body);
+		TRACE(module);
+		TRACE(ADDRESS OF module.next);
+		TRACE(ADDRESS OF module.name);
+		TRACE(ADDRESS OF module.init);
+		TRACE(ADDRESS OF module.published);
+		TRACE(ADDRESS OF module.body);
+		TRACE(ADDRESS OF module.refcnt);
+		TRACE(ADDRESS OF module.sb);
+		TRACE(ADDRESS OF module.entry);
+		TRACE(ADDRESS OF module.command); 
+		TRACE(ADDRESS OF module.ptrAdr);
+		TRACE(ADDRESS OF module.typeInfo);
+		TRACE(ADDRESS OF module.module);
+		TRACE(ADDRESS OF module.procTable);
+		TRACE(ADDRESS OF module.ptrTable);
+		TRACE(ADDRESS OF module.data); 
+		TRACE(ADDRESS OF module.code);
+		TRACE(ADDRESS OF module.staticTypeDescs);
+		TRACE(ADDRESS OF module.refs);
+		TRACE(ADDRESS OF module.export);
+		TRACE(ADDRESS OF module.term);
+		TRACE(ADDRESS OF module.exTable);
+		TRACE(ADDRESS OF module.noProcs);
+		TRACE(ADDRESS OF module.firstProc);
+		TRACE(ADDRESS OF module.maxPtrs);
+		TRACE(ADDRESS OF module.crc);
+		TRACE(ADDRESS OF module.body);
+			
+					
 		IF module.body # NIL THEN module.body END;
 		IF callagain THEN
 			PublishRegisteredModules (* does not return on intel architecture. Returns on ARM but looses procedure stack frame: we are not allowed to refer to local variables after this *)
@@ -341,6 +373,7 @@ BEGIN
 			module.init := TRUE;
 		END;
 	END;
+	TRACE(module.name);
 END Initialize0;
 
 (** Return the named module or NIL if it is not loaded yet. *)
@@ -927,6 +960,7 @@ END GetKernelProc;
 
 PROCEDURE Register- (module {UNTRACED}: Module);
 BEGIN {UNCOOPERATIVE, UNCHECKED}
+	TRACE(module.name);
 	IF register.first = NIL THEN
 		register.first := module;
 	ELSE
@@ -971,7 +1005,7 @@ END PublishRegisteredModules;
 (* procedure that will be called last in a linked kernel *)
 PROCEDURE {FINAL} Main;
 BEGIN
-	Machine.Init;
+	(*Machine.Init;*)
 	Trace.String("publish registered modules"); Trace.Ln;
 	PublishRegisteredModules;
 END Main;