acadia-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
Makefile.in
aclocal.m4
configure
configure.in
crt0.S
internal_syscall.h
kernel_stat.h
nano.specs
nanosleep.c
sim.specs
sys_access.c
sys_chdir.c
sys_chmod.c
sys_chown.c
sys_close.c
sys_conv_stat.c
sys_execve.c
sys_exit.c
sys_faccessat.c
sys_fork.c
sys_fstat.c
sys_fstatat.c
sys_ftime.c
sys_getcwd.c
sys_getpid.c
sys_gettimeofday.c
sys_isatty.c
sys_kill.c
sys_link.c
sys_lseek.c
sys_lstat.c
sys_open.c
sys_openat.c
sys_read.c
sys_sbrk.c
sys_stat.c
sys_sysconf.c
sys_times.c
sys_unlink.c
sys_utime.c
sys_wait.c
sys_write.c