[PATCH 3/3] mips: remove register spill
Adhemerval Zanella
adhemerval.zanella@linaro.org
Mon Nov 30 14:22:03 GMT 2020
On 28/11/2020 05:18, Huang Pei wrote:
> Before Linux/MIPS 2.6.36, kernel expected setting syscall number(aka
> "li v0, #sys_number") right precedes "syscall", so the kernel syscall
> restart sequence can use CP0 EPC - 4 to restart the syscall, because
> kernel DID NOT save v0 during syscall handling. Linux 2.6.36 canceled
> this restriction.
>
> See sysdeps/unix/sysv/linux/mips/{mips32/sysdep.h,mips64/sysdep.h,sysdep.h}
>
> Since glibc-2.24 the minimum kernel version is 3.2(much higer than
> 2.6.36), I think it is OK to remove the ugly register spill in
> syscall.S just because of the old convention
>
> Signed-off-by: Huang Pei <huangpei@loongson.cn>
We do not use SCO, but rather Copyright assignment.
The rest of the patch looks ok.
> ---
> sysdeps/unix/sysv/linux/mips/mips64/syscall.S | 14 ++------------
> 1 file changed, 2 insertions(+), 12 deletions(-)
>
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscall.S b/sysdeps/unix/sysv/linux/mips/mips64/syscall.S
> index aab1f389aa..089524a40b 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/syscall.S
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/syscall.S
> @@ -27,14 +27,9 @@
>
> .text
> NESTED (syscall, SZREG, ra)
> - .mask 0x00010000, -2 * SZREG
> + .mask 0x00000000, 0
> .fmask 0x00000000, 0
> - PTR_ADDIU sp, -2 * SZREG
> - cfi_adjust_cfa_offset (2 * SZREG)
> - REG_S s0, (sp)
> - cfi_rel_offset (s0, 0)
> -
> - move s0, a0
> + move v0, a0
> move a0, a1 /* shift arg1 - arg7. */
> move a1, a2
> move a2, a3
> @@ -43,13 +38,8 @@ NESTED (syscall, SZREG, ra)
> move a5, a6
> move a6, a7
>
> - move v0, s0 /* Syscall number -> v0 */
> syscall /* Do the system call. */
>
> - REG_L s0, (sp)
> - cfi_restore (s0)
> - 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