scc-patches

scc patches
Log | Files | Refs | README

0005-lib-c-Add-_cerrno.s-_getheap.c-and-raise.c-for-i386-.patch (2025B)


      1 From 85cd1a9da3643401773ca3eaead99654b6ccd742 Mon Sep 17 00:00:00 2001
      2 From: zerous Naveen Narayanan <zerous@nocebo.space>
      3 Date: Fri, 1 Nov 2019 15:24:43 +0100
      4 Subject: [PATCH 05/10] [lib/c] Add _cerrno.s, _getheap.c and raise.c for
      5  i386/linux
      6 
      7 Update Makefile
      8 ---
      9  src/libc/arch/i386/linux/Makefile   |  7 +++++++
     10  src/libc/arch/i386/linux/_cerrno.s  | 12 ++++++++++++
     11  src/libc/arch/i386/linux/_getheap.c |  1 +
     12  src/libc/arch/i386/linux/raise.c    |  1 +
     13  4 files changed, 21 insertions(+)
     14  create mode 100644 src/libc/arch/i386/linux/_cerrno.s
     15  create mode 100644 src/libc/arch/i386/linux/_getheap.c
     16  create mode 100644 src/libc/arch/i386/linux/raise.c
     17 
     18 diff --git a/src/libc/arch/i386/linux/Makefile b/src/libc/arch/i386/linux/Makefile
     19 index d264ea56..73415c86 100644
     20 --- a/src/libc/arch/i386/linux/Makefile
     21 +++ b/src/libc/arch/i386/linux/Makefile
     22 @@ -15,9 +15,12 @@ OBJS 	=\
     23  	_getpid.o\
     24  	_Exit.o\
     25  	_kill.o\
     26 +	_getheap.o\
     27  	crt.o\
     28  	umoddi3.o\
     29  	udivdi3.o\
     30 +	raise.o\
     31 +	_cerrno.o\
     32  
     33  all: syscall
     34  	$(MAKE) objs
     35 @@ -26,6 +29,10 @@ objs: $(OBJS)
     36  
     37  crt.o:	../crt-posix.s
     38  
     39 +_getheap.o:	../../posix/_getheap.c
     40 +
     41 +raise.o:	../../posix/raise.c
     42 +
     43  syscall: syscall.lst
     44  	gensys.sh syscall.lst
     45  	touch syscall
     46 diff --git a/src/libc/arch/i386/linux/_cerrno.s b/src/libc/arch/i386/linux/_cerrno.s
     47 new file mode 100644
     48 index 00000000..a14ec579
     49 --- /dev/null
     50 +++ b/src/libc/arch/i386/linux/_cerrno.s
     51 @@ -0,0 +1,12 @@
     52 +	.file	"_cerrno.s"
     53 +	.globl	_cerrno
     54 +
     55 +_cerrno:
     56 +	cmpl	$0,%eax
     57 +	js	1f
     58 +	ret
     59 +
     60 +1:	neg	%eax
     61 +	mov	%eax,(errno)
     62 +	mov	$-1,%eax
     63 +	ret
     64 diff --git a/src/libc/arch/i386/linux/_getheap.c b/src/libc/arch/i386/linux/_getheap.c
     65 new file mode 100644
     66 index 00000000..dc1a07bd
     67 --- /dev/null
     68 +++ b/src/libc/arch/i386/linux/_getheap.c
     69 @@ -0,0 +1 @@
     70 +#include "../../posix/_getheap.c"
     71 diff --git a/src/libc/arch/i386/linux/raise.c b/src/libc/arch/i386/linux/raise.c
     72 new file mode 100644
     73 index 00000000..138f6d88
     74 --- /dev/null
     75 +++ b/src/libc/arch/i386/linux/raise.c
     76 @@ -0,0 +1 @@
     77 +#include "../../posix/raise.c"
     78 -- 
     79 2.23.0
     80