[V2,2/2] mips: remove register spill
Commit Message
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
This also remove the unaligned stack pointer operation
---
sysdeps/unix/sysv/linux/mips/mips64/syscall.S | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
Comments
On 02/12/2020 00:33, 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
>
> This also remove the unaligned stack pointer operation
LGTM, thanks.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> ---
> 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 a9baff3c17..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, -SZREG
> + .mask 0x00000000, 0
> .fmask 0x00000000, 0
> - PTR_ADDIU sp, -SZREG
> - cfi_adjust_cfa_offset (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, SZREG
> - cfi_adjust_cfa_offset (-SZREG)
> bne a3, zero, L(error)
>
> ret
>
On Wed, 2 Dec 2020, 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.
I object, as I previously noted.
Maciej
@@ -27,14 +27,9 @@
.text
NESTED (syscall, SZREG, ra)
- .mask 0x00010000, -SZREG
+ .mask 0x00000000, 0
.fmask 0x00000000, 0
- PTR_ADDIU sp, -SZREG
- cfi_adjust_cfa_offset (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, SZREG
- cfi_adjust_cfa_offset (-SZREG)
bne a3, zero, L(error)
ret