[PATCH 0/1] Only pass the minimum number of syscall arguments (RISC-V)
Corinna Vinschen
vinschen@redhat.com
Tue Feb 11 08:43:00 GMT 2020
On Feb 10 21:19, Georg Sauthoff wrote:
> As is, the RISC-V syscall code unconditionally sets all possible syscall
> arguments even if the syscall requires fewer.
>
> For example, the instruction sequence for a exit syscall looked like
> this:
>
> li a0, 1 # in ther caller of exit()
> # ... # in newlib:
> li a1, 0 # unused arguments
> li a2, 0
> li a3, 0
> li a4, 0
> li a5, 0
> li a7, 93 # exit syscall number
>
> (i.e. the binary contains then 5 superfluous instructions for this
> one argument syscall)
>
> This patch changes the RISC-V syscall code such that only the required
> syscall argument registers are set.
>
> Georg Sauthoff (1):
> Only pass the minimum number of syscall arguments
>
> libgloss/riscv/internal_syscall.h | 41 ++++++++++++++++++++++---------
> libgloss/riscv/sys_access.c | 2 +-
> libgloss/riscv/sys_close.c | 2 +-
> libgloss/riscv/sys_exit.c | 2 +-
> libgloss/riscv/sys_faccessat.c | 2 +-
> libgloss/riscv/sys_fstat.c | 2 +-
> libgloss/riscv/sys_fstatat.c | 2 +-
> libgloss/riscv/sys_gettimeofday.c | 2 +-
> libgloss/riscv/sys_link.c | 2 +-
> libgloss/riscv/sys_lseek.c | 2 +-
> libgloss/riscv/sys_lstat.c | 2 +-
> libgloss/riscv/sys_open.c | 2 +-
> libgloss/riscv/sys_openat.c | 2 +-
> libgloss/riscv/sys_read.c | 2 +-
> libgloss/riscv/sys_sbrk.c | 4 +--
> libgloss/riscv/sys_stat.c | 2 +-
> libgloss/riscv/sys_unlink.c | 2 +-
> libgloss/riscv/sys_write.c | 2 +-
> 18 files changed, 48 insertions(+), 29 deletions(-)
>
> --
> 2.24.1
Pushed.
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20200211/928ed75b/attachment.sig>
More information about the Newlib
mailing list