Re: [PATCH] m68k: fix assembler constraint to prevent overeager gcc optimisation

Geert Uytterhoeven
2012-01-22T10:15:59Z

On Mon, Jan 9, 2012 at 15:10, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Passing the address of a variable as an operand to an asm statement
> doesn't mark the value of this variable as used, so gcc may optimize its
> initialisation away.  Fix this by using the "m" constraint instead.

Thanks! I'll apply and queue for -stable.

> diff --git a/arch/m68k/kernel/process_mm.c b/arch/m68k/kernel/process_mm.c
> index 1bc223a..aa4ffb8 100644
> --- a/arch/m68k/kernel/process_mm.c
> +++ b/arch/m68k/kernel/process_mm.c
> @@ -189,8 +189,8 @@ void flush_thread(void)
>        current->thread.fs = __USER_DS;
>        if (!FPU_IS_EMU)
>                asm volatile (".chip 68k/68881\n\t"
> -                             "frestore %0@\n\t"
> -                             ".chip 68k" : : "a" (&zero));
> +                             "frestore %0\n\t"
> +                             ".chip 68k" : : "m" (zero));
>  }
>
>  /*

This one was changed to:

| asm volatile ("frestore %0@" : : "a" (&zero) : "memory");

in v3.3-rc1.

I take it (but I prefer to ask, asm constraints always make me nervous)
the "memory" is no longer needed with your fix?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds