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

git-svn-id: trunk@31567 -
This commit is contained in:
nickysn 2015-09-07 01:52:48 +00:00
parent 026d2be316
commit a76c9ebd43

View File

@ -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.