ref: f07e299022e9ddc6c2ffd99135b2d9e382cf92d3
parent: 63818ff61c81da366ea7920d592444e3be6fd4e0
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Mar 7 03:43:56 EST 2017
[libc-amd64-linux] Add syscall script
--- /dev/null
+++ b/libc/src/sys/amd64-linux/Makefile
@@ -1,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
--- /dev/null
+++ b/libc/src/sys/amd64-linux/syscall.awk
@@ -1,0 +1,4 @@
+/^#/ {next}
+ {name=$2 ".s"
+ printf "%s:\n\tmov\t%d,%%rax\n\tsyscall\n\tret\n",$2, $1 > name
+ close(name)}
--- /dev/null
+++ b/libc/src/sys/amd64-linux/syscall.lst
@@ -1,0 +1,8 @@
+#number #name
+0 _read
+1 _write
+2 _open
+3 _close
+3 _lseek
+12 _brk
+60 _exit