ref: 0949cd4d71259d629db66da3955c389f0be2129c
parent: ab6005654710cbe137c97f50c015271ea1bf315b
author: zerous Naveen Narayanan <zerous@nocebo.space>
date: Sat Nov 16 08:43:50 EST 2019
Add _cerrno.s, _getheap.c, raise.c & signal.c for i386/linux
--- a/src/libc/arch/i386/linux/Makefile
+++ b/src/libc/arch/i386/linux/Makefile
@@ -15,8 +15,12 @@
_getpid.o\
_Exit.o\
_kill.o\
+ _getheap.o\
crt.o\
signal.o\
+ raise.o\
+ _cerrno.o\
+ signal.o
all: syscall
$(MAKE) objs
@@ -25,10 +29,14 @@
crt.o: ../crt-posix.s
+raise.o: ../../posix/raise.c
+
+signal.o: ../../posix/signal.c
+
syscall: syscall.lst
gensys.sh syscall.lst
touch syscall
clean:
- rm -f `awk '/[0-9]* _/ {print $$2".s"}' syscall.lst`
+ rm -f `awk '/[0-9]*\t/{print $$2".s"}' syscall.lst`
rm -f syscall _sys_errlist.c
--- /dev/null
+++ b/src/libc/arch/i386/linux/_cerrno.s
@@ -1,0 +1,12 @@
+ .file "_cerrno.s"
+ .globl _cerrno
+
+_cerrno:
+ cmpl $0,%eax
+ js 1f
+ ret
+
+1: neg %eax
+ mov %eax,(errno)
+ mov $-1,%eax
+ ret
--- /dev/null
+++ b/src/libc/arch/i386/linux/_getheap.c
@@ -1,0 +1,1 @@
+#include "../../posix/_getheap.c"
--- a/src/libc/arch/i386/linux/gensys.sh
+++ b/src/libc/arch/i386/linux/gensys.sh
@@ -1,7 +1,7 @@
#!/bin/sh
-awk '
-NR > 1 {syscall=$2
+awk '/^[0-9]*\t/ {
+ syscall=$2
fname=$2".s"
noper=$3
--- /dev/null
+++ b/src/libc/arch/i386/linux/raise.c
@@ -1,0 +1,1 @@
+#include "../../posix/raise.c"
--- /dev/null
+++ b/src/libc/arch/i386/linux/signal.c
@@ -1,0 +1,1 @@
+#include "../../posix/signal.c"