From d7669270b31585d427adb9b449727866160ca767 Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Thu, 2 Jan 2020 16:32:58 +0900 Subject: [PATCH] Add _exit() syscall to klibc --- include/unistd.h | 1 + kernel/klibc/posixcall.S | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/unistd.h b/include/unistd.h index 4b87539..1724114 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -4,6 +4,7 @@ #include #include +extern void _exit(int); extern pid_t fork(void); extern pid_t vfork(void); extern int execfve(void*, const char**, const char**); diff --git a/kernel/klibc/posixcall.S b/kernel/klibc/posixcall.S index faa10f7..ecc6004 100644 --- a/kernel/klibc/posixcall.S +++ b/kernel/klibc/posixcall.S @@ -7,6 +7,7 @@ .section .text + .global _exit .global fork .global execfve .global brk @@ -14,6 +15,16 @@ .global mmap .global munmap +_exit: + pushl %ebx + + movl $SYS_EXIT, %eax + movl 8(%esp), %ebx + int $SYSCALL_POSIX + + popl %ebx + ret + fork: pushl %ebx -- 2.47.3