[PATCH 0/1] Only pass the minimum number of syscall arguments (RISC-V)
Georg Sauthoff <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
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