瀏覽代碼

Patched an issue with 64-bit SSE Instructions (REX Prefix was missing)
This version contains ouput comparing against the old implementation

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

felixf 7 年之前
父節點
當前提交
0c6ec2fd32
共有 1 個文件被更改,包括 38 次插入3 次删除
  1. 38 3
      source/FoxAMD64Assembler.Mod

+ 38 - 3
source/FoxAMD64Assembler.Mod

@@ -399,6 +399,11 @@ TYPE
 				RETURN {InstructionSet.cpuFPU, InstructionSet.cpuSSE, InstructionSet.cpuSSE2, InstructionSet.cpuSSE3} * InstructionSet.instructions[instr].cpuOptions # {}
 				RETURN {InstructionSet.cpuFPU, InstructionSet.cpuSSE, InstructionSet.cpuSSE2, InstructionSet.cpuSSE3} * InstructionSet.instructions[instr].cpuOptions # {}
 			END FPOrSSEOperation;
 			END FPOrSSEOperation;
 
 
+			PROCEDURE FPOperation(instr: LONGINT): BOOLEAN;
+			BEGIN
+				RETURN {InstructionSet.cpuFPU} * InstructionSet.instructions[instr].cpuOptions # {}
+			END FPOperation;
+
 		BEGIN
 		BEGIN
 			IF (dump # NIL) & (lastPass) THEN
 			IF (dump # NIL) & (lastPass) THEN
 				pc0 := code.pc;
 				pc0 := code.pc;
@@ -495,9 +500,39 @@ TYPE
 								INCL (rexPrefix, rexX)
 								INCL (rexPrefix, rexX)
 							END
 							END
 						END;
 						END;
-						IF (operands[i].sizeInBytes = bits64) & ~(InstructionSet.optD64 IN bitwidthOptions) & ~FPOrSSEOperation(instr) THEN
+						IF (operands[i].sizeInBytes = bits64) & ~(InstructionSet.optD64 IN bitwidthOptions) & ~FPOperation(instr) THEN
 							IF Trace THEN KernelLog.String(" bits64 "); KernelLog.Ln; END;
 							IF Trace THEN KernelLog.String(" bits64 "); KernelLog.Ln; END;
-							INCL (rexPrefix, rexW)
+							IF FPOrSSEOperation(instr) THEN
+								IF (InstructionSet.instructions[instr].operands[i] = InstructionSet.regmem64) THEN 
+									kernelWriter.String("something wrong with this? "); 
+									DumpInstruction(kernelWriter,mnem,operands);
+									kernelWriter.Ln;
+									kernelWriter.Update;
+									INCL(rexPrefix, rexW) 
+								ELSE
+								END;
+							ELSE
+								IF ~(
+									(InstructionSet.instructions[instr].operands[i] = InstructionSet.regmem64)
+									OR
+									(InstructionSet.instructions[instr].operands[i] = InstructionSet.mem)
+								)
+								 THEN 
+									kernelWriter.String("something wrong with this? "); 
+									DumpInstruction(kernelWriter,mnem,operands);
+									kernelWriter.Ln;
+									kernelWriter.Int(InstructionSet.instructions[instr].operands[i],1); 
+									kernelWriter.Ln;
+									kernelWriter.Update;
+								END;
+								
+								ASSERT(
+									(InstructionSet.instructions[instr].operands[i] = InstructionSet.regmem64)
+									OR
+									(InstructionSet.instructions[instr].operands[i] = InstructionSet.mem)
+								); 
+								INCL(rexPrefix,rexW); 
+							END;
 						END;
 						END;
 						IF InstructionSet.instructions[instr].operands[i] = InstructionSet.moffset64 THEN
 						IF InstructionSet.instructions[instr].operands[i] = InstructionSet.moffset64 THEN
 							IF Trace THEN KernelLog.String(" moffset64 "); KernelLog.Ln; END;
 							IF Trace THEN KernelLog.String(" moffset64 "); KernelLog.Ln; END;
@@ -2757,7 +2792,7 @@ TYPE
 	END Test;
 	END Test;
 
 
 	BEGIN
 	BEGIN
-		IF Trace THEN
+		IF Trace OR TRUE THEN
 			NEW(kernelWriter,KernelLog.Send,1000);
 			NEW(kernelWriter,KernelLog.Send,1000);
 		END;
 		END;
 	END FoxAMD64Assembler.
 	END FoxAMD64Assembler.