Re: upwards growing stacks ??

linas@linas.org
Tue, 5 Oct 1999 23:29:10 -0500 (CDT)


It's been rumoured that Ralf Baechle said:
>
> On Sun, Oct 03, 1999 at 10:12:17PM -0500, Linas Vepstas wrote:
> > I've been porting the kernel to the ESA/390 architecture (mainframe)
> > and have had the occasion to rethink the subroutine linkage. In particular,
> > I have some weak reasons to want the stack to grow up, not down. However,
> > the unix tradition & linux in particular usually have the stack grow down.
> > So the questions:
> >
> > -- is it a bad idea to make the stack grow up?
> > -- has anyone done this before w/ linux? (doesn't seem like it ...)
> >
> > -- should I do this, or should I stick to the traditional design?
>
> Over the years I've ran over a number of pieces of code that would need to
> be fixed because they assume that the sky is blue, Microsoft is good
> and stacks always grow down ;-) So these are some weak reasons having
> for downward growing stacks.

OK, thanks.

My guess is that you refer to things that use setjump/longjump to implement
user-threads or other such multi-tasking-ish things. Sigh. What I've
concluded is to stick with the upward-growing stack.

-- I'm not completely alone, it sounds like HPPA & MkLinux folks have
experimented with this with some success (I have not yet contacted the guilty
parties, anybody care to forward this note?).

-- Some small fraction of some larger/more complex systems might break
(possibly things like DCEThreads and other large/complex packages,
e.g. CORBA's & other things that feel a need to fiddle with the stack).

-- I didn't hear of any other objections other than 'it bucks tradition'.

-- There's a minor security advantage to upward growing stacks.

-- The current upward-growth code shaves a couple or two cycles off of a
subroutine call, compared to the old code.

-- I'm lazy, I've changed the direction twice, and whacking on gcc to
change the stack direction is hard. The latest incarnation seems to work
although it does still contain some mystery bugs, possibly not related to the
stack at all. We'll find out.

Linas

>
> Ralf
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/