morphos: implement StackTop to get the stack top from the OS. stack boundaries are detected more precisely now, this fixes stack backtraces with shallow stack, among others

git-svn-id: trunk@36696 -
This commit is contained in:
Károly Balogh 2017-07-08 23:31:54 +00:00
parent c66daeb69f
commit cca38c9f08

View File

@ -78,9 +78,17 @@ var
implementation
{$define FPC_SYSTEM_HAS_STACKTOP}
{$I system.inc}
{$I osdebug.inc}
function StackTop: pointer;
begin
StackTop:=PETask(FindTask(nil)^.tc_ETask)^.PPCSPUpper;
end;
{$IFDEF MOSFPC_FILEDEBUG}
{$WARNING Compiling with file debug enabled!}
{$ENDIF}
@ -245,7 +253,7 @@ end;
begin
IsConsole := TRUE;
StackLength := CheckInitialStkLen(InitialStkLen);
StackBottom := Sptr - StackLength;
StackBottom := StackTop - StackLength;
{ OS specific startup }
MOS_ambMsg:=nil;
ASYS_origDir:=0;