scc

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

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

libc: Update arch/amd64/netbsd

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/netbsd/.gitignore | 4+++-
Msrc/libc/arch/amd64/netbsd/Makefile | 16++++++++--------
Dsrc/libc/arch/amd64/netbsd/_setcontext.s | 14--------------
Dsrc/libc/arch/amd64/netbsd/_sigaction2.s | 12------------
Msrc/libc/arch/amd64/netbsd/gensys.sh | 6+++++-
Msrc/libc/arch/amd64/netbsd/syscall.lst | 25++++++++++++++-----------
6 files changed, 30 insertions(+), 47 deletions(-)

diff --git a/src/libc/arch/amd64/netbsd/.gitignore b/src/libc/arch/amd64/netbsd/.gitignore @@ -1,11 +1,13 @@ -_Exit.s _brk.s _close.s +_exit.s _getpid.s _gettimeofday.s _kill.s _lseek.s _open.s _read.s +_setcontext.s +_sigaction2.s _sys_errlist.c _write.s diff --git a/src/libc/arch/amd64/netbsd/Makefile b/src/libc/arch/amd64/netbsd/Makefile @@ -5,24 +5,25 @@ include $(PROJECTDIR)/scripts/rules.mk include ../../../rules.mk GENOBJS =\ - _Exit.$O\ + _brk.$O\ _close.$O\ + _exit.$O\ _getpid.$O\ + _gettimeofday.$O\ _kill.$O\ _lseek.$O\ _open.$O\ _read.$O\ + _setcontext.$O\ + _sigaction2.$O\ _write.$O\ - _brk.$O\ - -GENSRC = $(GENOBJS:.$O=.s) OBJS =\ $(GENOBJS)\ - _setcontext.$O\ - _sigaction2.$O\ _sys_errlist.$O\ +GENSRC = $(GENOBJS:.$O=.s) + all: $(OBJS) $(CRT) crt.$O: ../crt-posix.s ../netbsd/crt.s @@ -31,7 +32,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/netbsd/_setcontext.s b/src/libc/arch/amd64/netbsd/_setcontext.s @@ -1,14 +0,0 @@ - - .text - .globl _Exit - .globl _setcontext - -_setcontext: - movq %r15,%rdi - movq $0x134,%rax - syscall - - # Something was wrong, finish the program. We can't call - # abort here because it could generate a loop - movq $-1,%rdi - jmp _Exit diff --git a/src/libc/arch/amd64/netbsd/_sigaction2.s b/src/libc/arch/amd64/netbsd/_sigaction2.s @@ -1,12 +0,0 @@ - -# This syscall cannot be autogenerated because it receives more than -# 4 arguments - - .text - .globl _sigaction2 - -_sigaction2: - mov $0x154,%eax - mov %rcx,%r10 - syscall - retq diff --git a/src/libc/arch/amd64/netbsd/gensys.sh b/src/libc/arch/amd64/netbsd/gensys.sh @@ -8,13 +8,17 @@ 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 jb 1f diff --git a/src/libc/arch/amd64/netbsd/syscall.lst b/src/libc/arch/amd64/netbsd/syscall.lst @@ -1,11 +1,14 @@ -#number name -1 _Exit -3 _read -4 _write -5 _open -6 _close -17 _brk -20 _getpid -37 _kill -199 _lseek -418 _gettimeofday +#Tab 15 +#number name nargs +1 _exit 1 +3 _read 3 +4 _write 3 +5 _open 3 +6 _close 1 +17 _brk 1 +20 _getpid 0 +37 _kill 2 +199 _lseek 3 +308 _setcontext 1 +340 _sigaction2 5 +418 _gettimeofday 2