linux-mips-fnet
[Top] [All Lists]

Re: DECstation boot code

To: linux-mips@fnet.fr
Subject: Re: DECstation boot code
From: Ralf Baechle <ralf@waldorf-gmbh.de>
Date: Wed, 11 Oct 1995 17:51:46 +0100 (MET)
In-reply-to: <Pine.LNX.3.91.951011105539.29874A-100000@yakko.prilnari.com> from "Matt Messier" at Oct 11, 95 10:58:48 am
Hi all,

> > You forgot to subtract 16 bytes from the stackpointer.  These 16 bytes
> > are the argument save space that need to be reserved for each call to
> > a subroutine.  In your case the main routine will try to save the
> > passed parameters onto the stack and by that overwriting something
> > else or writing to unmapped space ...  For more information about the
> > MIPS calling sequence please see the appendix in the often mentioned
> > MIPS bible from Kane.  Or ask me ...

> I'll be sure to take a look in my MIPS bible about that.  In the meantime,
> is that 16 bytes accounting for the 4 arguments passed into the boot code
> from the firmware (i.e., as seen in my boot.c code)?

Yes, the sixteen bytes are the space for a maximum of four parameters.
Always reserve at least 16 bytes plus 4 additional bytes for each extra
parameter.  Aligning the total amount to a multiple of 8 bytes will give

   - better performance
   - keep the stack pointer 64 bit aligned for doubleword access with
     bus error.

  Ralf

<Prev in Thread] Current Thread [Next in Thread>