[RFC PATCH 05/19] powerpc/32: Use load and store multiple in GPR save/restore macros

Christophe Leroy christophe.leroy at csgroup.eu
Thu Nov 3 19:26:45 AEDT 2022


It contradicts commit a85c728cb5e1 ("powerpc/32: Don't use lmw/stmw for 
saving/restoring non volatile regs")

Le 31/10/2022 à 06:54, Nicholas Piggin a écrit :
> ---
>   arch/powerpc/include/asm/ppc_asm.h | 18 ++++++++++++++++--
>   1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
> index 753a2757bcd4..ac44383d350a 100644
> --- a/arch/powerpc/include/asm/ppc_asm.h
> +++ b/arch/powerpc/include/asm/ppc_asm.h
> @@ -57,8 +57,22 @@
>   #define SAVE_NVGPRS(base)		SAVE_GPRS(14, 31, base)
>   #define REST_NVGPRS(base)		REST_GPRS(14, 31, base)
>   #else
> -#define SAVE_GPRS(start, end, base)	OP_REGS stw, 4, start, end, base, GPR0
> -#define REST_GPRS(start, end, base)	OP_REGS lwz, 4, start, end, base, GPR0
> +.macro __SAVE_GPRS start, end, base, offset
> +	.if \end == 31
> +		stmw	\start,\offset(\base)
> +	.else
> +		OP_REGS stw, 4, \start, \end, \base, \offset
> +	.endif
> +.endm
> +.macro __REST_GPRS start, end, base, offset
> +	.if \end == 31
> +		lmw	\start,\offset(\base)
> +	.else
> +		OP_REGS lwz, 4, \start, \end, \base, \offset
> +	.endif
> +.endm
> +#define SAVE_GPRS(start, end, base)	__SAVE_GPRS start, end, base, GPR0
> +#define REST_GPRS(start, end, base)	__REST_GPRS start, end, base, GPR0
>   #define SAVE_NVGPRS(base)		SAVE_GPRS(13, 31, base)
>   #define REST_NVGPRS(base)		REST_GPRS(13, 31, base)
>   #endif


More information about the Linuxppc-dev mailing list