Author: mcayland Date: Sun Oct 24 22:20:14 2010 New Revision: 919 URL: http://tracker.coreboot.org/trac/openbios/changeset/919
Log: Commit more readable version of obp_fortheval_v2 as posted to the mailing list, plus increase the default client image stack size on SPARC32 to help Solaris 8 boot.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@siriusit.co.uk
Modified: trunk/openbios-devel/arch/sparc32/context.c trunk/openbios-devel/arch/sparc32/romvec.c
Modified: trunk/openbios-devel/arch/sparc32/context.c ============================================================================== --- trunk/openbios-devel/arch/sparc32/context.c Sun Oct 24 21:55:27 2010 (r918) +++ trunk/openbios-devel/arch/sparc32/context.c Sun Oct 24 22:20:14 2010 (r919) @@ -11,7 +11,7 @@ #include "openbios.h"
#define MAIN_STACK_SIZE 16384 -#define IMAGE_STACK_SIZE 4096*2 +#define IMAGE_STACK_SIZE 4096*4
#define debug printk
Modified: trunk/openbios-devel/arch/sparc32/romvec.c ============================================================================== --- trunk/openbios-devel/arch/sparc32/romvec.c Sun Oct 24 21:55:27 2010 (r918) +++ trunk/openbios-devel/arch/sparc32/romvec.c Sun Oct 24 22:20:14 2010 (r919) @@ -424,41 +424,30 @@
void obp_fortheval_v2(char *str, int arg0, int arg1, int arg2, int arg3, int arg4) { - int pusharg = 0; + int dstacktmp = 0;
// It seems Solaris passes up to 5 arguments which should be pushed onto the Forth - // stack for execution. However the API doesn't provide for a way to pass the number - // of arguments actually passed. Hence we start at arg4 and then starting from the - // first non-zero argument, we push all subsequent arguments onto the stack down to - // arg0. - - if (arg4) { - PUSH(arg4); - pusharg = 1; - } - - if (arg3 || pusharg == 1 ) { - PUSH(arg3); - pusharg = 1; - } - - if (arg2 || pusharg == 1) { - PUSH(arg2); - pusharg = 1; - } - - if (arg1 || pusharg == 1 ) { - PUSH(arg1); - pusharg = 1; - } - - if (arg0 || pusharg == 1) { - PUSH(arg0); - } + // stack for execution. However the API doesn't provide for a way to specify the number + // of arguments actually being passed. Hence we preserve the state of the Forth stack + // before, push all the arguments, execute the Forth, then restore the stack to its + // previous state. This enables us to have a variable number of arguments and still + // preserve stack state between subsequent calls. + + // Preserve stack state + dstacktmp = dstackcnt; + + PUSH(arg4); + PUSH(arg3); + PUSH(arg2); + PUSH(arg1); + PUSH(arg0);
DPRINTF("obp_fortheval_v2(%s)\n", str); push_str(str); fword("eval"); + + // Restore stack state + dstackcnt = dstacktmp; }
void *