shithub: scc

Download patch

ref: b26325b6eb3d24678b009cd8492b487ea7f493c0
parent: 024c96cf957f7185b6d5e95bb8770f3de76f1de3
author: Roberto E. Vargas Caballero <[email protected]>
date: Tue Sep 14 10:47:48 EDT 2021

libc: Update arch/amd64/openbsd

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

--- a/src/libc/arch/amd64/openbsd/.gitignore
+++ b/src/libc/arch/amd64/openbsd/.gitignore
@@ -1,6 +1,6 @@
-_Exit.s
 _brk.s
 _close.s
+_exit.s
 _getpid.s
 _kill.s
 _lseek.s
@@ -7,6 +7,6 @@
 _open.s
 _read.s
 _sigaction.s
+_sigaction2.s
 _sys_errlist.c
 _write.s
-_sigaction2.s
--- a/src/libc/arch/amd64/openbsd/Makefile
+++ b/src/libc/arch/amd64/openbsd/Makefile
@@ -5,16 +5,16 @@
 include ../../../rules.mk
 
 GENOBJS =\
-	_Exit.$O\
+	_brk.$O\
 	_close.$O\
+	_exit.$O\
 	_getpid.$O\
 	_kill.$O\
 	_lseek.$O\
 	_open.$O\
 	_read.$O\
-	_write.$O\
-	_brk.$O\
 	_sigaction2.$O\
+	_write.$O\
 
 GENSRC = $(GENOBJS:.$O=.s)
 
--- a/src/libc/arch/amd64/openbsd/gensys.sh
+++ b/src/libc/arch/amd64/openbsd/gensys.sh
@@ -8,7 +8,7 @@
 sed -n "
      s/[ 	]*#.*//
      /$1/p" syscall.lst |
-while read num name
+while read num name nargs
 do
 cat <<EOF > $name.s
 	.file	"$name.s"
@@ -15,6 +15,10 @@
 
 	.globl	$name
 $name:
+	`case $nargs in 4|5|6)
+		echo "movq       %rcx,%r10"
+		;;
+	esac`
 	movq	\$$num,%rax
 	syscall
 	jb	1f
--- a/src/libc/arch/amd64/openbsd/syscall.lst
+++ b/src/libc/arch/amd64/openbsd/syscall.lst
@@ -1,11 +1,12 @@
-#number	name
-1	_Exit
-3	_read
-4	_write
-5	_open
-6	_close
-17	_brk
-20	_getpid
-46	_sigaction2
-122	_kill
-198	_lseek
+#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
+46	_sigaction2	5
+122	_kill	2
+198	_lseek	3