scc

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

commit 932bc4d2300493b9b8cbc1d4132e222d7c8c6129
parent 65ca72ef8bc98b2ebb229dbddf1b28c294bb313f
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 14 Sep 2021 14:47:48 +0200

libc: Update arch/amd64/darwin

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/darwin/.gitignore | 2+-
Msrc/libc/arch/amd64/darwin/Makefile | 10+++-------
Msrc/libc/arch/amd64/darwin/gensys.sh | 12++++++++----
Msrc/libc/arch/amd64/darwin/syscall.lst | 20+++++++++++---------
4 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/src/libc/arch/amd64/darwin/.gitignore b/src/libc/arch/amd64/darwin/.gitignore @@ -1,5 +1,5 @@ __close.s -__Exit.s +__exit.s __getpid.s __kill.s __lseek.s diff --git a/src/libc/arch/amd64/darwin/Makefile b/src/libc/arch/amd64/darwin/Makefile @@ -5,25 +5,22 @@ include $(PROJECTDIR)/scripts/rules.mk include ../../../rules.mk GENOBJS =\ - __Exit.$O\ __close.$O\ + __exit.$O\ __getpid.$O\ __kill.$O\ __lseek.$O\ __open.$O\ __read.$O\ - __write.$O\ __sigaction.$O\ + __write.$O\ GENSRC = $(GENOBJS:.$O=.s) OBJS =\ $(GENOBJS)\ - _getheap.$O\ _sys_errlist.$O\ -# Rules - all: $(OBJS) $(CRT) crt.$O: ../crt-posix.s @@ -32,7 +29,6 @@ $(GENSRC): syscall.lst ./gensys.sh $(@:.s=) clean: - rm -f $(GENSRC) - rm -f syscall _sys_errlist.c + rm -f $(GENSRC) _sys_errlist.c include deps.mk diff --git a/src/libc/arch/amd64/darwin/gensys.sh b/src/libc/arch/amd64/darwin/gensys.sh @@ -5,16 +5,20 @@ # until the 4th parameter, so we only have to set the syscall # number in rax -awk 'NF == 2 && $2 == "'$1'" { - printf("0x%x\t%s\n", 33554432 + $1, $2) -}' syscall.lst | -while read num name +awk 'BEGIN {n = 33554432} + {gsub(/ *#./, "")} + /'$1'/ {printf("0x%x\t%s\t%s\n", n + $1, $2, $3)}' syscall.lst | +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 jb 1f diff --git a/src/libc/arch/amd64/darwin/syscall.lst b/src/libc/arch/amd64/darwin/syscall.lst @@ -1,9 +1,11 @@ -1 __Exit -3 __read -4 __write -5 __open -6 __close -20 __getpid -46 __sigaction -37 __kill -199 __lseek +#Tab 15 +#number name nargs +1 __exit 1 +3 __read 3 +4 __write 3 +5 __open 3 +6 __close 1 +20 __getpid 0 +46 __sigaction 3 +37 __kill 2 +199 __lseek 3