newlib/libgloss/riscv
Georg Sauthoff 9b51beeb2a Only pass the minimum number of syscall arguments
Previously, __internal_syscall() compiled into asm-code that unconditionally
sets the syscall argument registers a0 to a5.

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 commit changes the RISC-V syscall code such that only the required
syscall argument registers are set.

GCC detects that argc is known at compile time and thus evaluates all the
if-statements where argc is used at compile time (tested with -O2 and -Os).
2020-02-11 09:41:52 +01:00
..
machine RISC-V: Moved syscalls to separate files to fix aliasing problems. 2017-12-26 12:27:52 -08:00
Makefile.in RISC-V: Add gdb sim and newlib nano support. Fix a few misc minor bugs. 2017-12-26 12:31:33 -08:00
aclocal.m4 Add RISC-V port for libgloss 2017-08-17 14:51:05 -04:00
configure Add RISC-V port for libgloss 2017-08-17 14:51:05 -04:00
configure.in Add RISC-V port for libgloss 2017-08-17 14:51:05 -04:00
crt0.S RISC-V: Add _LITE_EXIT in crt0.S. 2019-05-22 17:41:25 -07:00
internal_syscall.h Only pass the minimum number of syscall arguments 2020-02-11 09:41:52 +01:00
kernel_stat.h RISC-V: Moved syscalls to separate files to fix aliasing problems. 2017-12-26 12:27:52 -08:00
nano.specs RISC-V: Use newlib nano specific libm. 2020-01-31 12:42:52 +01:00
nanosleep.c RISC-V: Add nanosleep functionality 2017-12-26 12:24:45 -08:00
sim.specs RISC-V: Add gdb sim and newlib nano support. Fix a few misc minor bugs. 2017-12-26 12:31:33 -08:00
sys_access.c Only pass the minimum number of syscall arguments 2020-02-11 09:41:52 +01:00
sys_chdir.c RISC-V: Moved syscalls to separate files to fix aliasing problems. 2017-12-26 12:27:52 -08:00
sys_chmod.c RISC-V: Moved syscalls to separate files to fix aliasing problems. 2017-12-26 12:27:52 -08:00
sys_chown.c RISC-V: Moved syscalls to separate files to fix aliasing problems. 2017-12-26 12:27:52 -08:00
sys_close.c Only pass the minimum number of syscall arguments 2020-02-11 09:41:52 +01:00
sys_conv_stat.c RISC-V: Moved syscalls to separate files to fix aliasing problems. 2017-12-26 12:27:52 -08:00
sys_execve.c RISC-V: Moved syscalls to separate files to fix aliasing problems. 2017-12-26 12:27:52 -08:00
sys_exit.c Only pass the minimum number of syscall arguments 2020-02-11 09:41:52 +01:00
sys_faccessat.c Only pass the minimum number of syscall arguments 2020-02-11 09:41:52 +01:00
sys_fork.c RISC-V: Moved syscalls to separate files to fix aliasing problems. 2017-12-26 12:27:52 -08:00
sys_fstat.c Only pass the minimum number of syscall arguments 2020-02-11 09:41:52 +01:00
sys_fstatat.c Only pass the minimum number of syscall arguments 2020-02-11 09:41:52 +01:00
sys_ftime.c RISC-V: Moved syscalls to separate files to fix aliasing problems. 2017-12-26 12:27:52 -08:00
sys_getcwd.c RISC-V: Moved syscalls to separate files to fix aliasing problems. 2017-12-26 12:27:52 -08:00
sys_getpid.c RISC-V: Moved syscalls to separate files to fix aliasing problems. 2017-12-26 12:27:52 -08:00
sys_gettimeofday.c Only pass the minimum number of syscall arguments 2020-02-11 09:41:52 +01:00
sys_isatty.c RISC-V: isatty: return 0 on error 2018-01-18 09:21:10 +01:00
sys_kill.c RISC-V: Moved syscalls to separate files to fix aliasing problems. 2017-12-26 12:27:52 -08:00
sys_link.c Only pass the minimum number of syscall arguments 2020-02-11 09:41:52 +01:00
sys_lseek.c Only pass the minimum number of syscall arguments 2020-02-11 09:41:52 +01:00
sys_lstat.c Only pass the minimum number of syscall arguments 2020-02-11 09:41:52 +01:00
sys_open.c Only pass the minimum number of syscall arguments 2020-02-11 09:41:52 +01:00
sys_openat.c Only pass the minimum number of syscall arguments 2020-02-11 09:41:52 +01:00
sys_read.c Only pass the minimum number of syscall arguments 2020-02-11 09:41:52 +01:00
sys_sbrk.c Only pass the minimum number of syscall arguments 2020-02-11 09:41:52 +01:00
sys_stat.c Only pass the minimum number of syscall arguments 2020-02-11 09:41:52 +01:00
sys_sysconf.c RISC-V: Moved syscalls to separate files to fix aliasing problems. 2017-12-26 12:27:52 -08:00
sys_times.c RISC-V: Fixed return code in _times syscall. 2018-08-29 15:49:00 +02:00
sys_unlink.c Only pass the minimum number of syscall arguments 2020-02-11 09:41:52 +01:00
sys_utime.c RISC-V: Moved syscalls to separate files to fix aliasing problems. 2017-12-26 12:27:52 -08:00
sys_wait.c RISC-V: Moved syscalls to separate files to fix aliasing problems. 2017-12-26 12:27:52 -08:00
sys_write.c Only pass the minimum number of syscall arguments 2020-02-11 09:41:52 +01:00