[OpenBIOS] [PATCH] sparc32: fix __context corruption in __switch_context_nosave

Blue Swirl blauwirbel at gmail.com
Fri Feb 11 19:52:46 CET 2011


On Wed, Feb 9, 2011 at 8:37 PM, Artyom Tarasenko <atar4qemu at gmail.com> wrote:
> __switch_context_nosave shall not write to __context, only read it.
>
> Signed-off-by: Artyom Tarasenko <atar4qemu at gmail.com>
> --- arch/sparc32/switch.S       (revision 1024)
> +++ arch/sparc32/switch.S       (working copy)
> @@ -79,11 +79,14 @@
>        set     (PSR_PS | PSR_S | PSR_PIL | PSR_EF), %g2
>        wr      %g2, 0x0, %psr
>  #endif
> -
> +        set     __context, %g1
> +        swap      [%g1], %fp
> +        ba     __set_context
>  __switch_context_nosave:
> -       set     __context, %g1
> +        set     __context, %g1
>         /* Swap ctx pointer with %fp */

Shouldn't this comment be moved earlier, close to swap?

> -        swap      [%g1], %fp
> +        ld      [%g1], %fp
> +__set_context:
>        /* Load all registers */
>         /* offset 0: %g0, no need to load */
>         ld      [%fp + 4], %g1
>
> ---
> Regards,
> Artyom Tarasenko
>
> solaris/sparc under qemu blog: http://tyom.blogspot.com/
>



More information about the OpenBIOS mailing list