Răsfoiți Sursa

+ initialize StackBottom and StackLength in the win16 system unit startup code

git-svn-id: trunk@31567 -
nickysn 10 ani în urmă
părinte
comite
a76c9ebd43
1 a modificat fișierele cu 26 adăugiri și 0 ștergeri
  1. 26 0
      rtl/win16/system.pp

+ 26 - 0
rtl/win16/system.pp

@@ -116,6 +116,19 @@ type
   PFarChar = ^Char;far;
   PFarWord = ^Word;far;
 
+  { structure, located at DS:0, initialized by InitTask }
+  PAutoDataSegHeader = ^TAutoDataSegHeader;
+  TAutoDataSegHeader = record
+    null: Word;
+    oOldSP: Word;
+    hOldSS: Word;
+    pLocalHeap: Word;
+    pAtomTable: Word;
+    pStackTop: Word;
+    pStackMin: Word;
+    pStackBot: Word;
+  end;
+
 {$I registers.inc}
 
 {$define SYSTEMUNIT}
@@ -291,5 +304,18 @@ begin
 end;
 
 begin
+{$if defined(FPC_X86_DATA_FAR) or defined(FPC_X86_DATA_HUGE)}
+  with PAutoDataSegHeader(Ptr(DSeg,0))^ do
+    begin
+      StackBottom := Ptr(SSeg,pStackTop);
+      StackLength := pStackBot-pStackTop;
+    end;
+{$else}
+  with PAutoDataSegHeader(0)^ do
+    begin
+      StackBottom := NearPointer(pStackTop);
+      StackLength := pStackBot-pStackTop;
+    end;
+{$endif}
   MessageBox(0, 'Hello, world!', 'yo', 0);
 end.