[hackers] [scc] [libc-qbe-linux] Copy sys directory from amd64-linux || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Wed, 8 Mar 2017 14:51:13 +0100 (CET)

commit 36d9492c408ec4d07629be1798fec2ea4cc17b0e
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Wed Mar 8 10:39:03 2017 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Wed Mar 8 14:49:21 2017 +0100

    [libc-qbe-linux] Copy sys directory from amd64-linux
    
    Both sys-arch have the same implementation, because the
    system is the same in both cases.

diff --git a/libc/src/sys/qbe-linux/Makefile b/libc/src/sys/qbe-linux/Makefile
new file mode 100644
index 0000000..610244e
--- /dev/null
+++ b/libc/src/sys/qbe-linux/Makefile
_AT_@ -0,0 +1,25 @@
+# See LICENSE file for copyright and license details.
+.POSIX:
+
+include ../../../../config.mk
+
+OBJ_GEN = _read.o _write.o _open.o _close.o _lseek.o _brk.o\
+ _rt_sigaction.o _getpid.o _Exit.o _kill.o
+
+ASM_GEN = $(OBJ_GEN:.o=.s)
+OBJ = $(OBJ_GEN)
+
+all: $(OBJ) system.mk
+
+.s.o:
+ $(AS) $< -o $_AT_
+
+system.mk: Makefile
+ echo '$$(SYSOBJ)' = $(OBJ) > system.mk
+
+$(ASM_GEN): syscall.lst
+ awk -f syscall.awk < syscall.lst
+
+clean:
+ rm -f *.o
+ rm -f $(ASM_GEN)
diff --git a/libc/src/sys/qbe-linux/syscall.awk b/libc/src/sys/qbe-linux/syscall.awk
new file mode 100644
index 0000000..80b73bd
--- /dev/null
+++ b/libc/src/sys/qbe-linux/syscall.awk
_AT_@ -0,0 +1,11 @@
+# This job is very easy because app and kernel ABI are identical
+# until the 4th parameter, so we only have to set the syscall
+# number in rax
+
+/^#/ {next}
+ {name=$2 ".s"
+ printf "%s:\n" \
+ "\tmovq\t$%d,%%rax\n" \
+ "\tsyscall\n" \
+ "\tret\n",$2, $1 > name
+ close(name)}
diff --git a/libc/src/sys/qbe-linux/syscall.lst b/libc/src/sys/qbe-linux/syscall.lst
new file mode 100644
index 0000000..dcc5d68
--- /dev/null
+++ b/libc/src/sys/qbe-linux/syscall.lst
_AT_@ -0,0 +1,11 @@
+#number name
+0 _read
+1 _write
+2 _open
+3 _close
+3 _lseek
+12 _brk
+13 _rt_sigaction
+38 _getpid
+60 _Exit
+32 _kill
diff --git a/libc/src/sys/qbe-linux/system.mk b/libc/src/sys/qbe-linux/system.mk
new file mode 100644
index 0000000..7835082
--- /dev/null
+++ b/libc/src/sys/qbe-linux/system.mk
_AT_@ -0,0 +1 @@
+$(SYSOBJ) = _read.o _write.o _open.o _close.o _lseek.o _brk.o _rt_sigaction.o _getpid.o _Exit.o _kill.o _sbrk.o
Received on Wed Mar 08 2017 - 14:51:13 CET

This archive was generated by hypermail 2.3.0 : Wed Mar 08 2017 - 15:00:38 CET