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
|