Browse Source

Add i386 specific check that fpu stack is completely empty in CheckStack function

git-svn-id: trunk@29554 -
pierre 10 years ago
parent
commit
ddee662665
1 changed files with 16 additions and 0 deletions
  1. 16 0
      tests/test/cg/tcalext6.pp

+ 16 - 0
tests/test/cg/tcalext6.pp

@@ -64,6 +64,14 @@ end;
 procedure CheckStack;
 procedure CheckStack;
 var
 var
   newval : pointer;
   newval : pointer;
+{$ifdef cpui386}
+  { Test tag word of coprocessor }
+  {$asmmode att}
+  fpusave : record
+    Ctrl, Status,Tag : dword;
+    other : array [1..512] of byte;
+  end;
+{$endif}
 begin
 begin
 {$ifdef HAS_GET_FRAME}
 {$ifdef HAS_GET_FRAME}
   newval:=Get_Frame;
   newval:=Get_Frame;
@@ -75,6 +83,14 @@ begin
         ' to 0x',hexstr(ptruint(newval),2*sizeof(ptruint)));
         ' to 0x',hexstr(ptruint(newval),2*sizeof(ptruint)));
       Stackval:=newval;
       Stackval:=newval;
     end;
     end;
+ {$ifdef cpui386}
+    asm
+      fnsave fpusave
+      frstor fpusave
+    end;
+    if ((fpusave.tag and $ffff)<>$ffff) then
+      Writeln('Tag word not $ffff, ',hexstr((fpusave.tag and $ffff),4));
+  {$endif}
 end;
 end;
 {$endif UseStackCheck}
 {$endif UseStackCheck}