Mail Archives: djgpp-workers/2003/02/11/07:08:42
On Tue, 11 Feb 2003, Eli Zaretskii wrote:
> On Mon, 10 Feb 2003, CBFalconer wrote:
> > > Assuming that esp
> > > has already decremented to point to the newly allocated space,
> > > the possible overflow is detected thus:
> > I don't believe you should make any such assumption. You cannot
> > assume that anything called has stack checking code.
> I think you misunderstood what Esa was saying (or else I misunderstood
> it ;-). As I understand it, his code assumes to be called by GCC _after_
> each change in ESP. There's no assumption that the calling code was
> compiled with stack checking.
It seems like it's time to explain what gcc does with -fstack-check (or
rather, what's relevant here; the full story is in the gcc manual).
There's a pattern called stack_check in the machine description file;
this could be a single machine instruction for all gcc cares, but it's
usually a block of instructions that will be placed in gcc's output to
the assembler. This pattern takes one argument, which is the value of
esp after the allocation. The code fragment that I wrote checks the
validity of this argument (assuming it is in esp already), and nothing
student of mathematics at the University of Helsinki
- Raw text -