Assembly routine that takes an entry point, new stack pointer address

and six extra arguments.  Sets up the stack pointer with the arguments
in the right registers/stack positions and calls the entry point.
This commit is contained in:
simonb 1999-03-25 04:08:59 +00:00
parent 6b8114413a
commit 50e9ee5706
1 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,33 @@
/*
* startprog(entry, stack, argc, argv, prom_magic, prom_ptr, bi_magic, bi_ptr);
*
* load new stack pointer, then call
* entry(argc, argv, prom_magic, prom_ptr, bi_magic, bi_ptr);
*/
#include <mips/asm.h>
LEAF(startprog)
subu sp,sp,32
addu t0,a1,-CALLFRAME_SIZ # new stack value
move t1,a0
move a0,a2
move a1,a3
lw a2,48(sp) # load everything from old stack we need
lw a3,52(sp)
lw v0,56(sp)
lw v1,60(sp)
move sp,t0 # new stack pointer
sw ra,24(sp)
sw v0,16(sp)
sw v1,20(sp)
jal ra,t1
nop # BDslot
lw ra,24(sp) # should not get back here!
j ra
addu sp,sp,32
END(startprog)