[fpc-devel] StackBottom
Vincent Snijders
vsnijders at quicknet.nl
Mon Jan 9 19:59:03 CET 2006
Hi,
If I run the following program on windows xp, it shows me that the
StackBottom is located at $2FE80. I thought that the stack was always
contained in complete pages and therefore the StackBottom should be at a
4k boundary. Is that correct?
Assuming this, the correct value for the StackBottom should be $30000.
Then StackBottom should be initialized as
StackBottom := (Sptr - StackLength + $FFF) AND $FFFFF000;
(at program start Sptr doesn't point to the exact top of the stack).
I stumbled on this issue, because for backtrace some values at the top
of the stack were not considered valid frame pointers.
Vincent
==================
program Project1;
{$mode objfpc}{$H+}
uses
Classes
{ add your units here };
begin
writeln(HexStr(PtrUInt(StackBottom),SizeOf(Pointer)*2));
readln;
end.
More information about the fpc-devel
mailing list