Permalink
Browse files

Implemented the __sys_exit() operation for Linux (x86-64).

  • Loading branch information...
bendiken committed May 26, 2013
1 parent e8d493e commit 0d6b54644187295ab3a7fe263aa45c7ae46579de
Showing with 28 additions and 3 deletions.
  1. +1 −1 Makefile.am
  2. +2 −0 configure.ac
  3. +1 −1 src/Makefile.am
  4. +3 −1 src/stdlib/_Exit.c
  5. +7 −0 sys/.gitignore
  6. +7 −0 sys/Makefile.am
  7. +7 −0 sys/linux/x86_64/__sys_exit.S
View
@@ -1,3 +1,3 @@
-SUBDIRS = lib src test
+SUBDIRS = lib sys src test
EXTRA_DIST = AUTHORS CREDITS README UNLICENSE VERSION
ACLOCAL_AMFLAGS = -I etc/aclocal
View
@@ -36,6 +36,7 @@ AC_PROG_CC(clang gcc cc)
AC_PROG_CC_C99
AM_PROG_CC_C_O
AC_PROG_CPP
+AM_PROG_AS
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
LT_INIT
@@ -198,6 +199,7 @@ AC_CONFIG_FILES([
src/time/Makefile
src/uchar/Makefile
src/unistd/Makefile
+ sys/Makefile
test/Makefile
test/include/Makefile
test/assert/Makefile
View
@@ -1,7 +1,7 @@
lib_LTLIBRARIES = libc.la
libc_la_SOURCES =
-libc_la_LIBADD =
+libc_la_LIBADD = $(top_srcdir)/sys/libcsys.la
SUBDIRS = include
View
@@ -6,12 +6,14 @@
#include <stdlib.h>
+_Noreturn void __sys_exit(int status);
+
/**
* @date 2013-05-25
* @author Arto Bendiken
* @see http://libc11.org/stdlib/_Exit.html
*/
void
_Exit(const int status) {
- (void)status; // TODO
+ __sys_exit(status);
}
View
@@ -0,0 +1,7 @@
+.deps/
+.libs/
+.dirstamp
+*.a
+*.o
+*.la
+*.lo
View
@@ -0,0 +1,7 @@
+noinst_LTLIBRARIES = libcsys.la
+
+libcsys_la_SOURCES =
+libcsys_la_LIBADD =
+
+libcsys_la_SOURCES += \
+ linux/x86_64/__sys_exit.S
@@ -0,0 +1,7 @@
+.section .text
+
+.global __sys_exit
+__sys_exit:
+ movq $60, %rax /* sys_exit */
+ syscall
+ hlt

0 comments on commit 0d6b546

Please sign in to comment.