[PATCH 2/3] mips: make sp 16-byte aligned on N64/N32

Adhemerval Zanella adhemerval.zanella@linaro.org
Mon Nov 30 13:03:04 GMT 2020



On 28/11/2020 05:18, Huang Pei wrote:
> MIPS N64/N32 ABI request stack pointer be 16-byte alinged
> 

It seems to align what gcc assumes:

gcc/config/mips/mips.h

 364 #define TARGET_NEWABI               (mips_abi == ABI_N32 || mips_abi == ABI_64)

2525 /* Treat LOC as a byte offset from the stack pointer and round it up
2526    to the next fully-aligned offset.  */
2527 #define MIPS_STACK_ALIGN(LOC) \
2528   (TARGET_NEWABI ? ROUND_UP ((LOC), 16) : ROUND_UP ((LOC), 8))

(It would be easier that https://www.linux-mips.org/ could show 
this information easier, I could only find the old o32 ABI documentation).

> Signed-off-by: Huang Pei <huangpei@loongson.cn>

We do not use SCO, but rather Copyright assignments.

Patch looks ok regardless.

> ---
>  sysdeps/unix/sysv/linux/mips/mips64/syscall.S | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscall.S b/sysdeps/unix/sysv/linux/mips/mips64/syscall.S
> index a9baff3c17..aab1f389aa 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/syscall.S
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/syscall.S
> @@ -27,10 +27,10 @@
>  
>  	.text
>  NESTED (syscall, SZREG, ra)
> -	.mask 0x00010000, -SZREG
> +	.mask 0x00010000, -2 * SZREG
>  	.fmask 0x00000000, 0
> -	PTR_ADDIU sp, -SZREG
> -	cfi_adjust_cfa_offset (SZREG)
> +	PTR_ADDIU sp, -2 * SZREG
> +	cfi_adjust_cfa_offset (2 * SZREG)
>  	REG_S s0, (sp)
>  	cfi_rel_offset (s0, 0)
>  
> @@ -48,8 +48,8 @@ NESTED (syscall, SZREG, ra)
>  
>  	REG_L s0, (sp)
>  	cfi_restore (s0)
> -	PTR_ADDIU sp, SZREG
> -	cfi_adjust_cfa_offset (-SZREG)
> +	PTR_ADDIU sp, 2 * SZREG
> +	cfi_adjust_cfa_offset (-2 * 2 * SZREG)
>  	bne a3, zero, L(error)
>  
>  	ret
> 


More information about the Libc-alpha mailing list