From 8ebc924ac6d5ac272bd7dd9d46e59a7f5a430a2c Mon Sep 17 00:00:00 2001 From: Mark Seaborn Date: Thu, 22 Jan 2009 22:08:10 +0000 Subject: [PATCH] Hook up NaCl exit syscall --- sysdeps/nacl/_exit.c | 16 +++++++++++++ sysdeps/unix/sysv/linux/_exit.c | 43 ----------------------------------- sysdeps/unix/sysv/linux/i386/_exit.S | 44 ------------------------------------ 3 files changed, 16 insertions(+), 87 deletions(-) create mode 100644 sysdeps/nacl/_exit.c delete mode 100644 sysdeps/unix/sysv/linux/_exit.c delete mode 100644 sysdeps/unix/sysv/linux/i386/_exit.S diff --git a/sysdeps/nacl/_exit.c b/sysdeps/nacl/_exit.c new file mode 100644 index 0000000000..faf8313e59 --- /dev/null +++ b/sysdeps/nacl/_exit.c @@ -0,0 +1,16 @@ + +#include +#include + +#include + + +void _exit (int status) +{ + int (*nacl_exit)(int status) = NACL_SYSCALL_ADDR(NACL_sys_exit); + nacl_exit(status); + /* In case the syscall returns: */ + __asm__("hlt"); +} +libc_hidden_def (_exit) +weak_alias (_exit, _Exit) diff --git a/sysdeps/unix/sysv/linux/_exit.c b/sysdeps/unix/sysv/linux/_exit.c deleted file mode 100644 index 1477bd80f6..0000000000 --- a/sysdeps/unix/sysv/linux/_exit.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include -#include -#include -#include - - -void -_exit (status) - int status; -{ - while (1) - { -#ifdef __NR_exit_group - INLINE_SYSCALL (exit_group, 1, status); -#endif - INLINE_SYSCALL (exit, 1, status); - -#ifdef ABORT_INSTRUCTION - ABORT_INSTRUCTION; -#endif - } -} -libc_hidden_def (_exit) -weak_alias (_exit, _Exit) diff --git a/sysdeps/unix/sysv/linux/i386/_exit.S b/sysdeps/unix/sysv/linux/i386/_exit.S deleted file mode 100644 index 5c2e588409..0000000000 --- a/sysdeps/unix/sysv/linux/i386/_exit.S +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include - - .text - .type _exit,@function - .global _exit -_exit: - movl 4(%esp), %ebx - - /* Try the new syscall first. */ -#ifdef __NR_exit_group - movl $__NR_exit_group, %eax - ENTER_KERNEL -#endif - - /* Not available. Now the old one. */ - movl $__NR_exit, %eax - /* Don't bother using ENTER_KERNEL here. If the exit_group - syscall is not available AT_SYSINFO isn't either. */ - int $0x80 - - /* This must not fail. Be sure we don't return. */ - hlt - .size _exit,.-_exit - -libc_hidden_def (_exit) -weak_alias (_exit, _Exit) -- 2.11.4.GIT