commit 8f703c5646e41a78a2b3ae9d305e479f765ae43c
parent 10179858ebe703a0245279a17c08f97109510f45
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 7 Mar 2017 08:43:56 +0100
[libc-amd64-linux] Add syscall script
Diffstat:
3 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/libc/src/sys/amd64-linux/Makefile b/libc/src/sys/amd64-linux/Makefile
@@ -0,0 +1,14 @@
+
+OBJ = _brk.o _close.o _exit.o _lseek.o _open.o _read.o _write.o
+SRC = $(OBJ:.o=.s)
+
+all: $(OBJ)
+
+.s.o:
+ $(AS) $< -o $@
+
+$(SRC):
+ awk -f syscall.awk < syscall.lst
+
+clean:
+ rm -f *.s *.o
diff --git a/libc/src/sys/amd64-linux/syscall.awk b/libc/src/sys/amd64-linux/syscall.awk
@@ -0,0 +1,4 @@
+/^#/ {next}
+ {name=$2 ".s"
+ printf "%s:\n\tmov\t%d,%%rax\n\tsyscall\n\tret\n",$2, $1 > name
+ close(name)}
diff --git a/libc/src/sys/amd64-linux/syscall.lst b/libc/src/sys/amd64-linux/syscall.lst
@@ -0,0 +1,8 @@
+#number #name
+0 _read
+1 _write
+2 _open
+3 _close
+3 _lseek
+12 _brk
+60 _exit