scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit 42027ec8bb4d7dcdd943cad220852eaed14aa288
parent da801ad2a539302028cc0dd6246c50ded5287a07
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 14 Sep 2021 14:47:48 +0200

libc: Update arch/amd64/linux

This code is being updated out of the tree of scc and
it is time to synchroniza both copies now.

Diffstat:
Msrc/libc/arch/amd64/linux/.gitignore | 6+++---
Msrc/libc/arch/amd64/linux/Makefile | 28+++++++++++++---------------
Msrc/libc/arch/amd64/linux/gensys.sh | 8+++++---
Msrc/libc/arch/amd64/linux/syscall.lst | 29+++++++++++++++--------------
4 files changed, 36 insertions(+), 35 deletions(-)

diff --git a/src/libc/arch/amd64/linux/.gitignore b/src/libc/arch/amd64/linux/.gitignore @@ -1,6 +1,5 @@ -_Exit.s -_brk.s _close.s +_exit.s _getpid.s _getrusage.s _gettimeofday.s @@ -9,6 +8,7 @@ _lseek.s _open.s _read.s _sigaction.s +_sys_brk.s _sys_errlist.c -_write.s _unlink.s +_write.s diff --git a/src/libc/arch/amd64/linux/Makefile b/src/libc/arch/amd64/linux/Makefile @@ -1,42 +1,40 @@ .POSIX: -PROJECTDIR =../../../../.. +PROJECTDIR = ../../../../.. + include $(PROJECTDIR)/scripts/rules.mk include ../../../rules.mk GENOBJS =\ - _Exit.$O\ _close.$O\ + _exit.$O\ _getpid.$O\ + _getrusage.$O\ + _gettimeofday.$O\ _kill.$O\ _lseek.$O\ _open.$O\ _read.$O\ - _write.$O\ - _brk.$O\ - _gettimeofday.$O\ _sigaction.$O\ - _getrusage.$O\ + _sys_brk.$O\ _unlink.$O\ + _write.$O\ -GENSRC = $(GENOBJS:.$O=.s) - -OBJS = \ +OBJS =\ $(GENOBJS)\ - _cerrno.$O\ - _sys_errlist.$O\ + _cerrno.o\ + _sys_errlist.o\ -# Rules +GENSRC = $(GENOBJS:.$O=.s) all: $(OBJS) $(CRT) -crt.$O: ../crt-posix.s +$(CRT): ../crt-posix.s $(GENSRC): syscall.lst ./gensys.sh $(@:.s=) clean: - rm -f $(GENSRC) - rm -f _sys_errlist.c + rm -f $(GENSRC) _sys_errlist.c include deps.mk diff --git a/src/libc/arch/amd64/linux/gensys.sh b/src/libc/arch/amd64/linux/gensys.sh @@ -8,17 +8,19 @@ sed -n " s/[ ]*#.*// /$1/p" syscall.lst | -while read num name +while read num name nargs do - cat <<EOF > $name.s .file "$name.s" .globl $name $name: + `case $nargs in 4|5|6) + echo "movq %rcx,%r10" + ;; + esac` movq \$$num,%rax syscall jmp _cerrno EOF - done diff --git a/src/libc/arch/amd64/linux/syscall.lst b/src/libc/arch/amd64/linux/syscall.lst @@ -1,14 +1,15 @@ -#number name -0 _read -1 _write -2 _open -3 _close -8 _lseek -12 _brk -13 _sigaction -39 _getpid -60 _Exit -62 _kill -87 _unlink -96 _gettimeofday -98 _getrusage +#Tab 15 +#number name nargs +0 _read 3 +1 _write 3 +2 _open 3 +3 _close 1 +8 _lseek 3 +12 _sys_brk 1 +13 _sigaction 3 +39 _getpid 0 +60 _exit 1 +62 _kill 2 +87 _unlink 1 +96 _gettimeofday 2 +98 _getrusage 2