Преглед изворни кода

* don't care about __stklen anymore

git-svn-id: trunk@9028 -
florian пре 18 година
родитељ
комит
78ca6925ba
3 измењених фајлова са 18 додато и 10 уклоњено
  1. 4 0
      rtl/inc/system.inc
  2. 7 5
      rtl/win32/system.pp
  3. 7 5
      rtl/win64/system.pp

+ 4 - 0
rtl/inc/system.inc

@@ -44,7 +44,11 @@ const
 var
   { widechar, because also used by widestring -> pwidechar conversions }
   emptychar : widechar;public name 'FPC_EMPTYCHAR';
+{$ifndef FPC_NO_GENERIC_STACK_CHECK}
+  { if the OS does the stack checking, we don't need any stklen from the
+    main program }
   initialstklen : SizeUint;external name '__stklen';
+{$endif FPC_NO_GENERIC_STACK_CHECK}
 
 { checks whether the given suggested size for the stack of the current
  thread is acceptable. If this is the case, returns it unaltered.

+ 7 - 5
rtl/win32/system.pp

@@ -1083,7 +1083,7 @@ begin
    end;
 end;
 
-(* ProcessID cached to avoid repeated calls to GetCurrentProcess. *)
+{ ProcessID cached to avoid repeated calls to GetCurrentProcess. }
 
 var
   ProcessID: SizeUInt;
@@ -1093,9 +1093,10 @@ begin
  GetProcessID := ProcessID;
 end;
 
-function CheckInitialStkLen(stklen : SizeUInt) : SizeUInt;
-begin
-  result := stklen;
+function CheckInitialStkLen(stklen : SizeUInt) : SizeUInt;assembler;
+asm
+  movl  %fs:(4),%eax
+  subl  %fs:(8),%eax
 end;
 
 {
@@ -1105,7 +1106,8 @@ const
 }
 
 begin
-  StackLength := CheckInitialStkLen(InitialStkLen);
+  { pass dummy value }
+  StackLength := CheckInitialStkLen($1000000);
   StackBottom := StackTop - StackLength;
   { get some helpful informations }
   GetStartupInfo(@startupinfo);

+ 7 - 5
rtl/win64/system.pp

@@ -1136,17 +1136,19 @@ begin
 end;
 
 
-function CheckInitialStkLen(stklen : SizeUInt) : SizeUInt;
-begin
-  result := stklen;
+function CheckInitialStkLen(stklen : SizeUInt) : SizeUInt;assembler;
+asm
+  movq  %gs:(8),%rax
+  subq  %gs:(16),%rax
 end;
 
 
 begin
-  SysResetFPU;    
+  SysResetFPU;
   if not(IsLibrary) then
     SysInitFPU;
-  StackLength := CheckInitialStkLen(InitialStkLen);
+  { pass dummy value }
+  StackLength := CheckInitialStkLen($1000000);
   StackBottom := StackTop - StackLength;
   { get some helpful informations }
   GetStartupInfo(@startupinfo);