Re: [PATCH v2] mips: lib: uncached: fix non-standard usage of variable 'sp'

From: Maciej W. Rozycki
Date: Fri Dec 11 2020 - 14:58:10 EST


On Fri, 11 Dec 2020, Anders Roxell wrote:

> diff --git a/arch/mips/lib/uncached.c b/arch/mips/lib/uncached.c
> index 09d5deea747f..f80a67c092b6 100644
> --- a/arch/mips/lib/uncached.c
> +++ b/arch/mips/lib/uncached.c
> @@ -37,10 +37,12 @@
> */
> unsigned long run_uncached(void *func)
> {
> - register long sp __asm__("$sp");
> register long ret __asm__("$2");
> long lfunc = (long)func, ufunc;
> long usp;
> + long sp;
> +
> + __asm__("move %0, $sp" : "=r" (sp));

I thought it might be better to make `sp' global instead, so that it's
the compiler that chooses how to schedule accesses. Have you tried that?

Maciej