From b5bc52efe77e9f0deeb2ee141ea066ab18c927da Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 31 Aug 2003 17:24:25 +0000 Subject: Update. 2003-08-30 Jakub Jelinek * sysdeps/generic/sysdep.h (cfi_window_save, CFI_WINDOW_SAVE): Define. * sysdeps/unix/sysv/linux/sparc/bits/setjmp.h: Allow file to be included multiple times. * sysdeps/unix/sysv/linux/sparc/sparc32/clone.S (__clone): Pass ptid, tls, ctid arguments to the kernel. * sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize.c (__getpagesize): Use INTERNAL_SYSCALL instead of __syscall_getpagesize. * sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c (__libc_sigaction): Use INLINE_SYSCALL instead of __syscall_rt_sigaction. * sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list (__syscall_getgroups, __syscall_getpagesize, __syscall__llseek, __syscall_setfsgid, __syscall_setfsuid, __syscall_setgid, __syscall_setgroups, __syscall_setregid, __syscall_setreuid, __syscall_ipc, __syscall_setuid, __syscall_rt_sigaction, __syscall_rt_sigpending, __syscall_rt_sigprocmask, __syscall_rt_sigqueueinfo, __syscall_rt_sigsuspend, __syscall_rt_sigtimedwait): Remove unneeded syscall stubs. * sysdeps/unix/sysv/linux/sparc/sparc32/Makefile (sysdep_routines): Remove rt_sigsuspend, rt_sigprocmask, rt_sigtimedwait, rt_sigqueueinfo, rt_sigaction and rt_sigpending. * sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h (__CLONE_SYSCALL_STRING): Define. * sysdeps/unix/sysv/linux/sparc/sparc32/socket.S (__socket): Add CFI directives. * sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h (__CLONE_SYSCALL_STRING): Define. * sysdeps/unix/sysv/linux/sparc/sysdep.h (INLINE_CLONE_SYSCALL): Define. * sysdeps/unix/sysv/linux/sparc/system.c: New file. * sunrpc/rpc/clnt.h: Remove a few __THROW. * sunrpc/Makefile (CFLAGS-auth_unix.c): Add -fexceptions. (CFLAGS-key_call.c): Likewise. (CFLAGS-pmap_rmt.c): Likewise. * sunrpc/rpc/auth.h: Remove serveral __THROW. (CFLAGS-rcmd.c): Likewise. --- sysdeps/generic/sysdep.h | 5 ++++ sysdeps/unix/sysv/linux/sparc/bits/setjmp.h | 8 +++-- sysdeps/unix/sysv/linux/sparc/sparc32/Makefile | 5 ---- sysdeps/unix/sysv/linux/sparc/sparc32/clone.S | 11 +++++-- .../unix/sysv/linux/sparc/sparc32/getpagesize.c | 10 ++++--- sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c | 10 ++----- sysdeps/unix/sysv/linux/sparc/sparc32/socket.S | 5 ++++ .../unix/sysv/linux/sparc/sparc32/syscalls.list | 19 ------------ sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h | 16 ++++++++++ sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h | 12 ++++++++ sysdeps/unix/sysv/linux/sparc/system.c | 34 ++++++++++++++++++++++ 11 files changed, 96 insertions(+), 39 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/sparc/system.c (limited to 'sysdeps') diff --git a/sysdeps/generic/sysdep.h b/sysdeps/generic/sysdep.h index 9535c18eee..58c79281ed 100644 --- a/sysdeps/generic/sysdep.h +++ b/sysdeps/generic/sysdep.h @@ -63,6 +63,7 @@ # define cfi_undefined(reg) .cfi_undefined reg # define cfi_remember_state .cfi_remember_state # define cfi_restore_state .cfi_restore_state +# define cfi_window_save .cfi_window_save # else # define cfi_startproc # define cfi_endproc @@ -78,6 +79,7 @@ # define cfi_undefined(reg) # define cfi_remember_state # define cfi_restore_state +# define cfi_window_save # endif #else /* ! ASSEMBLER */ @@ -110,6 +112,8 @@ ".cfi_remember_state" # define CFI_RESTORE_STATE \ ".cfi_restore_state" +# define CFI_WINDOW_SAVE \ + ".cfi_window_save" # else # define CFI_STARTPROC # define CFI_ENDPROC @@ -125,6 +129,7 @@ # define CFI_UNDEFINED(reg) # define CFI_REMEMBER_STATE # define CFI_RESTORE_STATE +# define CFI_WINDOW_SAVE # endif #endif /* __ASSEMBLER__ */ diff --git a/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h b/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h index 664a06f60d..dac9ac5cba 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997,1999,2000 Free Software Foundation, Inc. +/* Copyright (C) 1997,1999,2000,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 @@ -16,8 +16,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 -#ifndef _SETJMP_H +#if !defined _SETJMP_H && !defined _PTHREAD_H # error "Never include directly; use instead." #endif @@ -78,3 +80,5 @@ typedef int __jmp_buf[3]; ((int) (address) < (jmpbuf)[JB_SP]) #endif + +#endif /* bits/setjmp.h */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile b/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile index 734b39d319..05fd8523b7 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile @@ -9,8 +9,3 @@ CFLAGS-rtld.c += -mv8 sysdep-others += lddlibc4 install-bin += lddlibc4 endif # elf - -ifeq ($(subdir),signal) -sysdep_routines += rt_sigsuspend rt_sigprocmask rt_sigtimedwait \ - rt_sigqueueinfo rt_sigaction rt_sigpending -endif diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S b/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S index 647519a033..5bebe35628 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998, 2000, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson (rth@tamu.edu). @@ -23,7 +23,8 @@ #include #include -/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */ +/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg, + pid_t *ptid, void *tls, pid_t *ctid); */ .text .align 4 @@ -39,6 +40,12 @@ __clone: orcc %i1,%g0,%o1 be .Lerror mov %i2,%o0 + /* ptid */ + mov %i4,%o2 + /* tls */ + mov %i5,%o3 + /* ctid */ + ld [%fp+92],%o4 /* Do the system call */ set __NR_clone,%g1 diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize.c b/sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize.c index 6ae341f9ef..42ef9d332e 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize.c +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1997, 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 @@ -19,6 +19,7 @@ #include #include #include +#include /* Return the system page size. This value will either be 4k or 8k depending on whether or not we are running on Sparc v9 machine. */ @@ -27,13 +28,14 @@ via the AT_PAGESZ auxiliary argument. If we are a static program, we use the getpagesize system call. */ -extern size_t __syscall_getpagesize(void); - int __getpagesize () { if (GL(dl_pagesize) == 0) - GL(dl_pagesize) = __syscall_getpagesize(); + { + INTERNAL_SYSCALL_DECL (err); + GL(dl_pagesize) = INTERNAL_SYSCALL (getpagesize, err, 0); + } return GL(dl_pagesize); } libc_hidden_def (__getpagesize) diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c b/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c index af34740e19..7fb6459d77 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c @@ -23,10 +23,7 @@ #include #include #include - -extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *, - struct kernel_sigaction *, unsigned long, - size_t); +#include static void __rt_sigreturn_stub (void); static void __sigreturn_stub (void); @@ -64,9 +61,8 @@ __libc_sigaction (int sig, __const struct sigaction *act, /* XXX The size argument hopefully will have to be changed to the real size of the user-level sigset_t. */ - ret = __syscall_rt_sigaction (sig, act ? &kact : 0, - oact ? &koact : 0, - stub, _NSIG / 8); + ret = INLINE_SYSCALL (rt_sigaction, 5, sig, act ? &kact : 0, + oact ? &koact : 0, stub, _NSIG / 8); if (ret >= 0 || errno != ENOSYS) { diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/socket.S b/sysdeps/unix/sysv/linux/sparc/sparc32/socket.S index 94b46e1849..3c12278e6a 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/socket.S +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/socket.S @@ -79,7 +79,11 @@ ENTRY (__socket) #if defined NEED_CANCELLATION && defined CENABLE .Lsocket_cancel: + cfi_startproc save %sp, -96, %sp + cfi_def_cfa_register (%fp) + cfi_window_save + cfi_register (%o7, %i7) CENABLE nop mov %o0, %l0 @@ -93,6 +97,7 @@ ENTRY (__socket) mov %l0, %o0 jmpl %i7 + 8, %g0 restore %g0, %l1, %o0 + cfi_endproc SYSCALL_ERROR_HANDLER2 #endif diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list index cb4971fff8..6d8e32f9f7 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list @@ -1,27 +1,8 @@ # File name Caller Syscall name # args Strong name Weak names -s_getgroups getgroups getgroups 2 __syscall_getgroups -s_getpagesize getpagesize getpagesize 0 __syscall_getpagesize -s_llseek llseek _llseek 5 __syscall__llseek -s_setfsgid setfsgid setfsgid 1 __syscall_setfsgid -s_setfsuid setfsuid setfsuid 1 __syscall_setfsuid -s_setgid setgid setgid 1 __syscall_setgid -s_setgroups setgroups setgroups 2 __syscall_setgroups -s_setregid setregid setregid 2 __syscall_setregid -s_setreuid setreuid setreuid 2 __syscall_setreuid setrlimit - setrlimit 2 __setrlimit setrlimit getrlimit - getrlimit 2 __getrlimit getrlimit -s_ipc msgget ipc 5 __syscall_ipc -s_setuid setuid setuid 1 __syscall_setuid setresuid - setresuid32 3 __setresuid setresuid setresgid - setresgid32 3 __setresgid setresgid getresuid - getresuid32 3 getresuid getresgid - getresgid32 3 getresgid - -# System calls with wrappers. -rt_sigaction - rt_sigaction 4 __syscall_rt_sigaction -rt_sigpending - rt_sigpending 2 __syscall_rt_sigpending -rt_sigprocmask - rt_sigprocmask 4 __syscall_rt_sigprocmask -rt_sigqueueinfo - rt_sigqueueinfo 3 __syscall_rt_sigqueueinfo -rt_sigsuspend - rt_sigsuspend 2 __syscall_rt_sigsuspend -rt_sigtimedwait - rt_sigtimedwait 4 __syscall_rt_sigtimedwait diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h index 6dcf0cd57f..5ba9f3f88b 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h @@ -181,6 +181,22 @@ SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler) \ " restore %%g0, -1, %%o0;" \ ".previous;" +#define __CLONE_SYSCALL_STRING \ + "ta 0x10;" \ + "bcs 2f;" \ + " sub %%o1, 1, %%o1;" \ + "and %%o0, %%o1, %%o0;" \ + "1:" \ + ".subsection 2;" \ + "2:" \ + "save %%sp, -192, %%sp;" \ + "call __errno_location;" \ + " nop;" \ + "st %%i0, [%%o0];" \ + "ba 1b;" \ + " restore %%g0, -1, %%o0;" \ + ".previous;" + #define __INTERNAL_SYSCALL_STRING \ "ta 0x10;" \ "bcs,a 1f;" \ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h index 5340fca9d1..7e88ea58ac 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h @@ -152,6 +152,18 @@ SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler) \ "restore %%g0, -1, %%o0;" \ "1:" +#define __CLONE_SYSCALL_STRING \ + "ta 0x6d;" \ + "bcc,pt %%xcc, 1f;" \ + " sub %%o1, 1, %%o1;" \ + "save %%sp, -192, %%sp;" \ + "call __errno_location;" \ + " mov -1, %%i1;" \ + "st %%i0,[%%o0];" \ + "restore %%g0, -1, %%o0;" \ + "1:" \ + "and %%o0, %%o1, %%o0" + #define __INTERNAL_SYSCALL_STRING \ "ta 0x6d;" \ "bcs,a,pt %%xcc, 1f;" \ diff --git a/sysdeps/unix/sysv/linux/sparc/system.c b/sysdeps/unix/sysv/linux/sparc/system.c new file mode 100644 index 0000000000..22bef622d9 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/system.c @@ -0,0 +1,34 @@ +/* Copyright (C) 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 + +/* We have to and actually can handle cancelable system(). The big + problem: we have to kill the child process if necessary. To do + this a cleanup handler has to be registered and is has to be able + to find the PID of the child. The main problem is to reliable have + the PID when needed. It is not necessary for the parent thread to + return. It might still be in the kernel when the cancellation + request comes. Therefore we have to use the clone() calls ability + to have the kernel write the PID into the user-level variable. */ +#ifdef __ASSUME_CLONE_THREAD_FLAGS +# define FORK() \ + INLINE_CLONE_SYSCALL (CLONE_PARENT_SETTID | SIGCHLD, 0, &pid, NULL, NULL) +#endif + +#include "../system.c" -- cgit 1.4.1