Rob Mayoff wrote:

+---------- On Feb 12, Jerry Asher said:

>At any rate, I had thought we were talking about, for the most part,
>rare occasions when new threads are created.


I thought we were talking about checking SP every time something (like
a stack frame) is pushed onto the stack. That means you have to know
the limit for SP every time you push a stack frame. The limit depends
on which stack you're using, which in turn depends on which thread is
executing. So you can either store the limits in TLS, or in a global
table which you search using the current SP as the key.
See that's the problem with long threads.  We should probably just
declare hitler and get on with our work.  My crawling back up *this
thread's stack* leads me to believe stack creation and allocation was
the problem.

I would think that if I am really pushing a stack frame onto a stack,
then I presumably have to know where the base of the stack is and the
top of stack.  If I know where the base of the stack is, I should be
able to lookup what the max stack size is?  However you store the base
and the top, can be the same place/same mechanism to store the size?
And so it should take just a bit more arithmetic on a stack frame push
to check the stack limits....

I once read that Goering coded it up as follows:

struct stack {
    ulong maxsize;
    void *top;
    long base;
}

I'll let you determine how Ms. Braun, herself coded the stack frame push
itself as an exercise, or we can leave it here.

Jerry

Reply via email to