From e5b5ba471f30f1237d6a92e1408a641dcd76175c Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Tue, 21 Mar 2006 20:54:56 +0000 Subject: [PATCH] * sysdeps/unix/sysv/linux/arm/eabi/socket.S: Delete. * sysdeps/unix/sysv/linux/arm/eabi/syscalls.list, sysdeps/unix/sysv/linux/arm/eabi/umount.c: New files. * sysdeps/unix/sysv/linux/arm/eabi/linuxthreads/sysdep-cancel.h (DOCARGS_6, UNDOCARGS_6, RESTORE_LR_6): Define. * sysdeps/unix/sysv/linux/arm/eabi/nptl/sysdep-cancel.h (DOCARGS_6, UNDOCARGS_6, RESTORE_LR_6): Define. * sysdeps/unix/sysv/linux/arm/eabi/sysdep.h: Undefine __NR_stime and __NR_alarm. --- ChangeLog.arm | 12 ++ .../arm/eabi/linuxthreads/sysdep-cancel.h | 10 +- .../sysv/linux/arm/eabi/nptl/sysdep-cancel.h | 10 +- sysdeps/unix/sysv/linux/arm/eabi/socket.S | 131 ------------------ .../unix/sysv/linux/arm/eabi/syscalls.list | 34 +++++ sysdeps/unix/sysv/linux/arm/eabi/sysdep.h | 8 +- sysdeps/unix/sysv/linux/arm/eabi/umount.c | 31 +++++ 7 files changed, 98 insertions(+), 138 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/arm/eabi/socket.S create mode 100644 sysdeps/unix/sysv/linux/arm/eabi/syscalls.list create mode 100644 sysdeps/unix/sysv/linux/arm/eabi/umount.c diff --git a/ChangeLog.arm b/ChangeLog.arm index 017847529e..21f9abde70 100644 --- a/ChangeLog.arm +++ b/ChangeLog.arm @@ -1,3 +1,15 @@ +2006-03-21 Daniel Jacobowitz + + * sysdeps/unix/sysv/linux/arm/eabi/socket.S: Delete. + * sysdeps/unix/sysv/linux/arm/eabi/syscalls.list, + sysdeps/unix/sysv/linux/arm/eabi/umount.c: New files. + * sysdeps/unix/sysv/linux/arm/eabi/linuxthreads/sysdep-cancel.h + (DOCARGS_6, UNDOCARGS_6, RESTORE_LR_6): Define. + * sysdeps/unix/sysv/linux/arm/eabi/nptl/sysdep-cancel.h + (DOCARGS_6, UNDOCARGS_6, RESTORE_LR_6): Define. + * sysdeps/unix/sysv/linux/arm/eabi/sysdep.h: Undefine + __NR_stime and __NR_alarm. + 2006-03-02 Daniel Jacobowitz * sysdeps/unix/sysv/linux/arm/linuxthreads/sysdep-cancel.h diff --git a/sysdeps/unix/sysv/linux/arm/eabi/linuxthreads/sysdep-cancel.h b/sysdeps/unix/sysv/linux/arm/eabi/linuxthreads/sysdep-cancel.h index f77333f106..bc520426ef 100644 --- a/sysdeps/unix/sysv/linux/arm/eabi/linuxthreads/sysdep-cancel.h +++ b/sysdeps/unix/sysv/linux/arm/eabi/linuxthreads/sysdep-cancel.h @@ -53,9 +53,9 @@ UNDOARGS_##args; \ cmn r0, $4096; -/* DOARGS pushes four bytes on the stack for five arguments, and nothing - otherwise. In order to preserve doubleword alignment, sometimes we must - save an extra register. */ +/* DOARGS pushes four bytes on the stack for five arguments, eight bytes for + six arguments, and nothing for fewer. In order to preserve doubleword + alignment, sometimes we must save an extra register. */ # define DOCARGS_0 stmfd sp!, {r7, lr} # define UNDOCARGS_0 @@ -81,6 +81,10 @@ # define UNDOCARGS_5 ldmfd sp!, {r0, r1, r2, r3} # define RESTORE_LR_5 ldmfd sp!, {r4, r7, lr} +# define DOCARGS_6 stmfd sp!, {r0, r1, r2, r3, r7, lr} +# define UNDOCARGS_6 ldmfd sp!, {r0, r1, r2, r3} +# define RESTORE_LR_6 RESTORE_LR_0 + # ifdef IS_IN_libpthread # define CENABLE bl PLTJMP(__pthread_enable_asynccancel) # define CDISABLE bl PLTJMP(__pthread_disable_asynccancel) diff --git a/sysdeps/unix/sysv/linux/arm/eabi/nptl/sysdep-cancel.h b/sysdeps/unix/sysv/linux/arm/eabi/nptl/sysdep-cancel.h index 5e89399116..92fe90385f 100644 --- a/sysdeps/unix/sysv/linux/arm/eabi/nptl/sysdep-cancel.h +++ b/sysdeps/unix/sysv/linux/arm/eabi/nptl/sysdep-cancel.h @@ -64,9 +64,9 @@ UNDOARGS_##args; \ cmn r0, $4096; -/* DOARGS pushes four bytes on the stack for five arguments, and nothing - otherwise. In order to preserve doubleword alignment, sometimes we must - save an extra register. */ +/* DOARGS pushes four bytes on the stack for five arguments, eight bytes for + six arguments, and nothing for fewer. In order to preserve doubleword + alignment, sometimes we must save an extra register. */ # define RESTART_UNWIND .fnend; .fnstart; .save {r7, lr} @@ -94,6 +94,10 @@ # define UNDOCARGS_5 ldmfd sp!, {r0, r1, r2, r3}; .fnend; .fnstart; .save {r4}; .save {r7, lr}; .pad #4 # define RESTORE_LR_5 ldmfd sp!, {r4, r7, lr} +# define DOCARGS_6 .save {r4, r5}; stmfd sp!, {r0, r1, r2, r3, r7, lr}; .save {r7, lr}; .pad #20 +# define UNDOCARGS_6 ldmfd sp!, {r0, r1, r2, r3}; .fnend; .fnstart; .save {r4, r5}; .save {r7, lr} +# define RESTORE_LR_6 RESTORE_LR_0 + # ifdef IS_IN_libpthread # define CENABLE bl PLTJMP(__pthread_enable_asynccancel) # define CDISABLE bl PLTJMP(__pthread_disable_asynccancel) diff --git a/sysdeps/unix/sysv/linux/arm/eabi/socket.S b/sysdeps/unix/sysv/linux/arm/eabi/socket.S deleted file mode 100644 index f614213fd3..0000000000 --- a/sysdeps/unix/sysv/linux/arm/eabi/socket.S +++ /dev/null @@ -1,131 +0,0 @@ -/* Copyright (C) 1995, 1996, 1997, 1998, 2003, 2005 - 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 - -#define P(a, b) P2(a, b) -#define P2(a, b) a##b - - .text -/* The socket-oriented system calls are handled unusally in Linux. - They are all gated through the single `socketcall' system call number. - `socketcall' takes two arguments: the first is the subcode, specifying - which socket function is being called; and the second is a pointer to - the arguments to the specific function. - - The .S files for the other calls just #define socket and #include this. */ - -#ifndef __socket -# ifndef NO_WEAK_ALIAS -# define __socket P(__,socket) -# else -# define __socket socket -# endif -#endif - -#define PUSHARGS_1 str a1, [sp, $-8]!; .pad #8 -#define PUSHARGS_2 stmfd sp!, {a1, a2}; .pad #8 -#define PUSHARGS_3 stmfd sp!, {a1, a2, a3, a4}; .pad #16 /* a4 pushed for padding */ -#define PUSHARGS_4 stmfd sp!, {a1, a2, a3, a4}; .pad #16 -#define PUSHARGS_5 stmfd sp!, {a1, a2, a3, a4}; .pad #16 /* Caller has already pushed arg 5 */ -#define PUSHARGS_6 stmfd sp!, {a1, a2, a3, a4}; .pad #16 - -#define POPARGS_1 add sp, sp, #8 -#define POPARGS_2 add sp, sp, #8 -#define POPARGS_3 add sp, sp, #16 -#define POPARGS_4 add sp, sp, #16 -#define POPARGS_5 add sp, sp, #16 -#define POPARGS_6 add sp, sp, #16 - -#ifndef NARGS -#define NARGS 3 /* If we were called with no wrapper, this is really socket() */ -#endif - -#if defined NEED_CANCELLATION && defined CENABLE - PSEUDO_PROLOGUE -#endif - -.globl __socket -ENTRY (__socket) - .fnstart - - /* This code previously moved sp into ip and stored the args using - stmdb ip!, {a1-a4}. It did not modify sp, so the stack never had - to be restored after the syscall completed. It saved an - instruction and meant no stack cleanup work was required. - - This will not work in the case of a socket call being interrupted - by a signal. If the signal handler uses any stack the arguments - to socket will be trashed. The results of a restart of any - socket call are then unpredictable. */ - - /* Push args onto the stack. */ - P(PUSHARGS_,NARGS) - -#if defined NEED_CANCELLATION && defined CENABLE - SINGLE_THREAD_P - bne 1f -#endif - - /* Do the system call trap. */ - mov a1, $P(SOCKOP_,socket) - mov a2, sp - DO_CALL (socketcall, 0) - - /* Pop args off the stack */ - P(POPARGS_,NARGS) - - /* r0 is < 0 if there was an error. */ - cmn r0, $124 - RETINSTR(cc, r14) - b PLTJMP(SYSCALL_ERROR) - -#if defined NEED_CANCELLATION && defined CENABLE -1: - stmfd sp!, {r7, lr} - .save {r7, lr} - CENABLE - mov ip, r0 - - mov r0, #P(SOCKOP_,socket) - add r1, sp, #8 - mov r7, #SYS_ify(socketcall) - swi 0x0 - - mov r7, r0 - mov r0, ip - CDISABLE - mov r0, r7 - ldmfd sp!, {r7, lr} - - P(POPARGS_,NARGS) - - /* r0 is < 0 if there was an error. */ - cmn r0, $124 - RETINSTR(cc, r14) - b PLTJMP(SYSCALL_ERROR) -#endif - - .fnend -PSEUDO_END (__socket) - -#ifndef NO_WEAK_ALIAS -weak_alias (__socket, socket) -#endif diff --git a/sysdeps/unix/sysv/linux/arm/eabi/syscalls.list b/sysdeps/unix/sysv/linux/arm/eabi/syscalls.list new file mode 100644 index 0000000000..31e1cd6102 --- /dev/null +++ b/sysdeps/unix/sysv/linux/arm/eabi/syscalls.list @@ -0,0 +1,34 @@ +# File name Caller Syscall name # args Strong name Weak names + +# semaphore and shm system calls +msgctl - msgctl i:iip __msgctl msgctl +msgget - msgget i:ii __msgget msgget +msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv +msgsnd - msgsnd Ci:ibni __msgsnd msgsnd +shmat - shmat i:ipi __shmat shmat +shmctl - shmctl i:iip __shmctl shmctl +shmdt - shmdt i:s __shmdt shmdt +shmget - shmget i:iii __shmget shmget +semop - semop i:ipi __semop semop +semtimedop - semtimedop i:ipip semtimedop +semget - semget i:iii __semget semget +semctl - semctl i:iiii __semctl semctl + +# proper socket implementations: +accept - accept Ci:iBN __libc_accept __accept accept +bind - bind i:ipi __bind bind +connect - connect Ci:ipi __libc_connect __connect_internal __connect connect +getpeername - getpeername i:ipp __getpeername getpeername +getsockname - getsockname i:ipp __getsockname getsockname +getsockopt - getsockopt i:iiiBN __getsockopt getsockopt +listen - listen i:ii __listen listen +recv - recv Ci:ibni __libc_recv __recv recv +recvfrom - recvfrom Ci:ibniBN __libc_recvfrom __recvfrom recvfrom +recvmsg - recvmsg Ci:ipi __libc_recvmsg __recvmsg recvmsg +send - send Ci:ibni __libc_send __send send +sendmsg - sendmsg Ci:ipi __libc_sendmsg __sendmsg sendmsg +sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto +setsockopt - setsockopt i:iiibn __setsockopt setsockopt +shutdown - shutdown i:ii __shutdown shutdown +socket - socket i:iii __socket socket +socketpair - socketpair i:iiif __socketpair socketpair diff --git a/sysdeps/unix/sysv/linux/arm/eabi/sysdep.h b/sysdeps/unix/sysv/linux/arm/eabi/sysdep.h index 7f5ded5580..bf9c8d76b8 100644 --- a/sysdeps/unix/sysv/linux/arm/eabi/sysdep.h +++ b/sysdeps/unix/sysv/linux/arm/eabi/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005 +/* Copyright (C) 2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -29,6 +29,12 @@ # error Kernel headers are too old #endif +/* Don't use stime, even if the kernel headers define it. We have + settimeofday, and some EABI kernels have removed stime. Similarly + use setitimer to implement alarm. */ +#undef __NR_stime +#undef __NR_alarm + /* The ARM EABI user interface passes the syscall number in r7, instead of in the swi. This is more efficient, because the kernel does not need to fetch the swi from memory to find out the number; which can be painful diff --git a/sysdeps/unix/sysv/linux/arm/eabi/umount.c b/sysdeps/unix/sysv/linux/arm/eabi/umount.c new file mode 100644 index 0000000000..e7c5690890 --- /dev/null +++ b/sysdeps/unix/sysv/linux/arm/eabi/umount.c @@ -0,0 +1,31 @@ +/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Huggins-Daines , 2000. + + 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. */ + +/* Since we don't have an oldumount system call, do what the kernel + does down here. */ + +extern long int __umount2 (const char *name, int flags); + +long int +__umount (const char *name) +{ + return __umount2 (name, 0); +} + +weak_alias (__umount, umount);