[OpenBIOS] [commit] r915 - trunk/openbios-devel/arch/sparc32

Artyom Tarasenko atar4qemu at gmail.com
Tue Oct 19 11:33:31 CEST 2010


On Mon, Oct 18, 2010 at 9:32 PM, repository service <svn at openbios.org> wrote:
> Author: mcayland
> Date: Mon Oct 18 21:32:16 2010
> New Revision: 915
> URL: http://tracker.coreboot.org/trac/openbios/changeset/915
>
> Log:
> Fix the placing of Forth arguments on the stack when calling obp_fortheval_v2() via romvec on SPARC32.
>
> The extra stack arguments are actually placed within %o1-%o5 but unfortunately there doesn't seem to be a way of passing the
> number of parameters using the romvec API. Hence we go through the argument list and start pushing arguments onto the Forth
> stack from the first non-zero argument before executing the Forth string.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at siriusit.co.uk>
>
> Modified:
>   trunk/openbios-devel/arch/sparc32/openprom.h
>   trunk/openbios-devel/arch/sparc32/romvec.c
>
> Modified: trunk/openbios-devel/arch/sparc32/openprom.h
> ==============================================================================
> --- trunk/openbios-devel/arch/sparc32/openprom.h        Sun Oct 17 14:15:44 2010        (r914)
> +++ trunk/openbios-devel/arch/sparc32/openprom.h        Mon Oct 18 21:32:16 2010        (r915)
> @@ -124,7 +124,7 @@
>        /* Evaluate a forth string, not different proto for V0 and V2->up. */
>        union {
>                void (*v0_eval)(int len, char *str);
> -               void (*v2_eval)(char *str);
> +               void (*v2_eval)(char *str, int arg0, int arg1, int arg2, int arg3, int arg4);
>        } pv_fortheval;
>
>        const struct linux_arguments_v0 * const *pv_v0bootargs;
>
> Modified: trunk/openbios-devel/arch/sparc32/romvec.c
> ==============================================================================
> --- trunk/openbios-devel/arch/sparc32/romvec.c  Sun Oct 17 14:15:44 2010        (r914)
> +++ trunk/openbios-devel/arch/sparc32/romvec.c  Mon Oct 18 21:32:16 2010        (r915)
> @@ -412,15 +412,39 @@
>     return 0;
>  }
>
> -static void obp_fortheval_v2(char *str)
> +static void obp_fortheval_v2(char *str, int arg0, int arg1, int arg2, int arg3, int arg4)
>  {
> -  // for now, move something to the stack so we
> -  // don't get a stack underrun.
> -  //
> -  // FIXME: find out why solaris doesnt put its stuff on the stack
> -  //
> -  fword("0");
> -  fword("0");
> +  int pusharg = 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.

Why do you think it's up to 5, and not just always 5?

> +
> +  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);
> +  }
>
>   DPRINTF("obp_fortheval_v2(%s)\n", str);
>   push_str(str);
>
> --
> OpenBIOS                 http://openbios.org/
> Mailinglist:  http://lists.openbios.org/mailman/listinfo
> Free your System - May the Forth be with you
>



-- 
Regards,
Artyom Tarasenko

solaris/sparc under qemu blog: http://tyom.blogspot.com/



More information about the OpenBIOS mailing list