Merge sysdeps/unix/sysv/linux/arm/eabi into sysdeps/unix/sysv/linux/arm.

This commit is contained in:
Joseph Myers 2012-04-21 08:38:55 -07:00
parent 9002644d9f
commit 25593dcaf4
46 changed files with 391 additions and 471 deletions

View File

@ -1,3 +1,164 @@
2012-04-21 Joseph Myers <joseph@codesourcery.com>
[BZ #13556]
* sysdeps/unix/sysv/linux/arm/socket.S: Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (syscall): Remove.
(oldgetrlimit): Likewise.
(oldsetrlimit): Likewise.
(syscall): Likewise.
(msgget): Add syscall from eabi/syscalls.list.
(msgrcv): Likewise.
(msgsnd): Likewise.
(shmat): Likewise.
(shmdt): Likewise.
(shmget): Likewise.
(semop): Likewise.
(semtimedop): Likewise.
(semget): Likewise.
(accept): Likewise.
(bind): Likewise.
(connect): Likewise.
(getpeername): Likewise.
(getsockname): Likewise.
(getsockopt): Likewise.
(listen): Likewise.
(recv): Likewise.
(recvfrom): Likewise.
(recvmsg): Likewise.
(send): Likewise.
(sendmsg): Likewise.
(sendto): Likewise.
(setsockopt): Likewise.
(shutdown): Likewise.
(socket): Likewise.
(socketpair): Likewise.
* sysdeps/unix/sysv/linux/arm/eabi/syscalls.list: Remove.
* sysdeps/unix/sysv/linux/arm/Makefile [subdir = csu]
(CFLAGS-libc-start.c): Add setting from eabi/Makefile.
[subdir = rt] (librt-sysdep_routines): Likewise.
[subdir = rt] (librt-shared-only-routines): Likewise.
[subdir = nptl] (libpthread-sysdep_routines): Likewise.
[subdir = nptl] (libpthread-shared-only-routines): Likewise.
[subdir = resolv] (libanl-sysdep_routines): Likewise.
[subdir = resolv] (libanl-shared-only-routines): Likewise.
[subdir = csu] (sysdep_routines): Likewise.
[subdir = nscd] (nscd-modules): Likewise.
[subdir = nss] (libnss_db-sysdep_routines): Likewise.
[subdir = nss] (libnss_db-shared-only-routines): Likewise.
[subdir = posix] (LDFLAGS-tst-rfc3484): Likewise.
[subdir = posix] (LDFLAGS-tst-rfc3484-2): Likewise.
[subdir = posix] (LDFLAGS-tst-rfc3484-3): Likewise.
* sysdeps/unix/sysv/linux/arm/eabi/Makefile: Remove.
* sysdeps/unix/sysv/linux/arm/sysdep.h (__NR_SYSCALL_BASE): Add
test from eabi/sysdep.h.
(__NR_stime): Add #undef from eabi/sysdep.h.
(__NR_alarm): Likewise.
(DO_CALL): Use definition from eabi/sysdep.h.
(DOARGS_0): Likewise.
(DOARGS_1): Likewise.
(DOARGS_2): Likewise.
(DOARGS_3): Likewise.
(DOARGS_4): Likewise.
(DOARGS_5): Likewise.
(DOARGS_6): Likewise.
(DOARGS_7): Likewise.
(UNDOARGS_0): Likewise.
(UNDOARGS_1): Likewise.
(UNDOARGS_2): Likewise.
(UNDOARGS_3): Likewise.
(UNDOARGS_4): Likewise.
(UNDOARGS_5): Likewise.
(UNDOARGS_6): Likewise.
(UNDOARGS_7): Likewise.
(INTERNAL_SYSCALL_RAW): Likewise.
[__thumb__] (LOAD_ARGS_7): Do not define.
[__thumb__] (ASM_ARGS_7): Likewise.
(INTERNAL_SYSCALL_NCS): Use definition from eabi/sysdep.h.
(INTERNAL_SYSCALL_NCS_0): Remove.
(INTERNAL_SYSCALL_NCS_1): Likewise.
(INTERNAL_SYSCALL_NCS_2): Likewise.
(INTERNAL_SYSCALL_NCS_3): Likewise.
(INTERNAL_SYSCALL_NCS_4): Likewise.
(INTERNAL_SYSCALL_NCS_5): Likewise.
* sysdeps/unix/sysv/linux/arm/eabi/sysdep.h: Remove.
* sysdeps/unix/sysv/linux/arm/eabi/____longjmp_chk.S: Move to ...
* sysdeps/unix/sysv/linux/arm/____longjmp_chk.S: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/configure.in: Move to ...
* sysdeps/unix/sysv/linux/arm/configure.in: ... here. Update
comment.
* sysdeps/unix/sysv/linux/arm/eabi/configure: Move to ...
* sysdeps/unix/sysv/linux/arm/configure: ... here. Regenerate.
* sysdeps/unix/sysv/linux/arm/eabi/ftruncate64.c: Move to ...
* sysdeps/unix/sysv/linux/arm/ftruncate64.c: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/getcontext.S: Move to ...
* sysdeps/unix/sysv/linux/arm/getcontext.S: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/internal_accept4.S: Move to ...
* sysdeps/unix/sysv/linux/arm/internal_accept4.S: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/internal_recvmmsg.S: Move to ...
* sysdeps/unix/sysv/linux/arm/internal_recvmmsg.S: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/internal_sendmmsg.S: Move to ...
* sysdeps/unix/sysv/linux/arm/internal_sendmmsg.S: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S: Move to ...
* sysdeps/unix/sysv/linux/arm/libc-do-syscall.S: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/makecontext.c: Move to ...
* sysdeps/unix/sysv/linux/arm/makecontext.c: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/mmap64.S: Move to ...
* sysdeps/unix/sysv/linux/arm/mmap64.S: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/msgctl.c: Move to ...
* sysdeps/unix/sysv/linux/arm/msgctl.c: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/oldgetrlimit.c: Move to ...
* sysdeps/unix/sysv/linux/arm/oldgetrlimit.c: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/oldsetrlimit.c: Move to ...
* sysdeps/unix/sysv/linux/arm/oldsetrlimit.c: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/pread.c: Move to ...
* sysdeps/unix/sysv/linux/arm/pread.c: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/pread64.c: Move to ...
* sysdeps/unix/sysv/linux/arm/pread64.c: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/pwrite.c: Move to ...
* sysdeps/unix/sysv/linux/arm/pwrite.c: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/pwrite64.c: Move to ...
* sysdeps/unix/sysv/linux/arm/pwrite64.c: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/readahead.c: Move to ...
* sysdeps/unix/sysv/linux/arm/readahead.c: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/semctl.c: Move to ...
* sysdeps/unix/sysv/linux/arm/semctl.c: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/setcontext.S: Move to ...
* sysdeps/unix/sysv/linux/arm/setcontext.S: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/shmctl.c: Move to ...
* sysdeps/unix/sysv/linux/arm/shmctl.c: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/sigrestorer.S: Move to ...
* sysdeps/unix/sysv/linux/arm/sigrestorer.S: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/swapcontext.S: Move to ...
* sysdeps/unix/sysv/linux/arm/swapcontext.S: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/syscall.S: Move to ...
* sysdeps/unix/sysv/linux/arm/syscall.S: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/truncate64.c: Move to ...
* sysdeps/unix/sysv/linux/arm/truncate64.c: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/umount.c: Move to ...
* sysdeps/unix/sysv/linux/arm/umount.c: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/nptl/Makefile: Move to ...
* sysdeps/unix/sysv/linux/arm/nptl/Makefile: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/nptl/configure.in: Move to ...
* sysdeps/unix/sysv/linux/arm/nptl/configure.in: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/nptl/configure: Move to ...
* sysdeps/unix/sysv/linux/arm/nptl/configure: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/nptl/nptl-aeabi_unwind_cpp_pr1.c:
Move to ...
* sysdeps/unix/sysv/linux/arm/nptl/nptl-aeabi_unwind_cpp_pr1.c:
... here.
* sysdeps/unix/sysv/linux/arm/eabi/nptl/rt-aeabi_unwind_cpp_pr1.c:
Move to ...
* sysdeps/unix/sysv/linux/arm/nptl/rt-aeabi_unwind_cpp_pr1.c: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/nptl/sysdep-cancel.h: Move to ...
* sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-forcedunwind.c:
Move to ...
* sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-resume.c: Move to ...
* sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c: ... here.
* sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind.h: Move to ...
* sysdeps/unix/sysv/linux/arm/nptl/unwind.h: ... here.
2012-04-16 Andreas Jaeger <aj@suse.de>
* sysdeps/unix/sysv/linux/arm/ldsodefs.h: Undefine

View File

@ -1,3 +1,9 @@
2012-04-21 Joseph Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/linux/mips/mips32/readahead.c: Include
sysdeps/unix/sysv/linux/arm/readahead.c not
sysdeps/unix/sysv/linux/arm/eabi/readahead.c.
2012-03-28 Joseph Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/linux/mips/bits/mman.h (MAP_STACK): Define.

View File

@ -1,4 +1,9 @@
ifeq ($(subdir),csu)
# In order for unwinding to fail when it falls out of main, we need a
# cantunwind marker. There's one in start.S. To make sure we reach it, add
# unwind tables for __libc_start_main.
CFLAGS-libc-start.c += -fexceptions
sysdep_routines += aeabi_read_tp libc-aeabi_read_tp
static-only-routines += aeabi_read_tp
shared-only-routines += libc-aeabi_read_tp
@ -24,3 +29,39 @@ endif
ifeq ($(subdir),stdlib)
gen-as-const-headers += ucontext_i.sym
endif
# Add a syscall function to each library that needs one.
ifeq ($(subdir),rt)
librt-sysdep_routines += libc-do-syscall
librt-shared-only-routines += libc-do-syscall
endif
ifeq ($(subdir),nptl)
libpthread-sysdep_routines += libc-do-syscall
libpthread-shared-only-routines += libc-do-syscall
endif
ifeq ($(subdir),resolv)
libanl-sysdep_routines += libc-do-syscall
libanl-shared-only-routines += libc-do-syscall
endif
ifeq ($(subdir),csu)
sysdep_routines += libc-do-syscall
endif
ifeq ($(subdir),nscd)
nscd-modules += libc-do-syscall
endif
ifeq ($(subdir),nss)
libnss_db-sysdep_routines += libc-do-syscall
libnss_db-shared-only-routines += libc-do-syscall
endif
ifeq ($(subdir),posix)
LDFLAGS-tst-rfc3484 += $(common-objpfx)csu/libc-do-syscall.o
LDFLAGS-tst-rfc3484-2 += $(common-objpfx)csu/libc-do-syscall.o
LDFLAGS-tst-rfc3484-3 += $(common-objpfx)csu/libc-do-syscall.o
endif

View File

@ -1,5 +1,5 @@
# This file is generated from configure.in by Autoconf. DO NOT EDIT!
# Local configure fragment for sysdeps/unix/sysv/linux/arm/eabi.
# Local configure fragment for sysdeps/unix/sysv/linux/arm.
arch_minimum_kernel=2.6.16
libc_cv_gcc_unwind_find_fde=no

View File

@ -1,5 +1,5 @@
GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
# Local configure fragment for sysdeps/unix/sysv/linux/arm/eabi.
# Local configure fragment for sysdeps/unix/sysv/linux/arm.
arch_minimum_kernel=2.6.16
libc_cv_gcc_unwind_find_fde=no

View File

@ -1,42 +0,0 @@
ifeq ($(subdir),csu)
# In order for unwinding to fail when it falls out of main, we need a
# cantunwind marker. There's one in start.S. To make sure we reach it, add
# unwind tables for __libc_start_main.
CFLAGS-libc-start.c += -fexceptions
endif
# Add a syscall function to each library that needs one.
ifeq ($(subdir),rt)
librt-sysdep_routines += libc-do-syscall
librt-shared-only-routines += libc-do-syscall
endif
ifeq ($(subdir),nptl)
libpthread-sysdep_routines += libc-do-syscall
libpthread-shared-only-routines += libc-do-syscall
endif
ifeq ($(subdir),resolv)
libanl-sysdep_routines += libc-do-syscall
libanl-shared-only-routines += libc-do-syscall
endif
ifeq ($(subdir),csu)
sysdep_routines += libc-do-syscall
endif
ifeq ($(subdir),nscd)
nscd-modules += libc-do-syscall
endif
ifeq ($(subdir),nss)
libnss_db-sysdep_routines += libc-do-syscall
libnss_db-shared-only-routines += libc-do-syscall
endif
ifeq ($(subdir),posix)
LDFLAGS-tst-rfc3484 += $(common-objpfx)csu/libc-do-syscall.o
LDFLAGS-tst-rfc3484-2 += $(common-objpfx)csu/libc-do-syscall.o
LDFLAGS-tst-rfc3484-3 += $(common-objpfx)csu/libc-do-syscall.o
endif

View File

@ -1,32 +0,0 @@
# File name Caller Syscall name # args Strong name Weak names
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
msgget - msgget i:ii __msgget msgget
msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
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
# 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

View File

@ -1,199 +0,0 @@
/* Copyright (C) 2005, 2006, 2007, 2009
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Daniel Jacobowitz <dan@codesourcery.com>, Oct 2005.
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, see
<http://www.gnu.org/licenses/>. */
#ifndef _LINUX_ARM_EABI_SYSDEP_H
#define _LINUX_ARM_EABI_SYSDEP_H 1
#include <arm/sysdep.h>
#include <tls.h>
#if __NR_SYSCALL_BASE != 0
# 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
with separate I-cache and D-cache. Make sure to use 0 for the SWI
argument; otherwise the (optional) compatibility code for APCS binaries
may be invoked. */
#if defined(__thumb__)
/* We can not expose the use of r7 to the compiler. GCC (as
of 4.5) uses r7 as the hard frame pointer for Thumb - although
for Thumb-2 it isn't obviously a better choice than r11.
And GCC does not support asms that conflict with the frame
pointer.
This would be easier if syscall numbers never exceeded 255,
but they do. For the moment the LOAD_ARGS_7 is sacrificed.
We can't use push/pop inside the asm because that breaks
unwinding (i.e. thread cancellation) for this frame. We can't
locally save and restore r7, because we do not know if this
function uses r7 or if it is our caller's r7; if it is our caller's,
then unwinding will fail higher up the stack. So we move the
syscall out of line and provide its own unwind information. */
#undef LOAD_ARGS_7
#undef INTERNAL_SYSCALL_RAW
#define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \
({ \
register int _a1 asm ("a1"); \
int _nametmp = name; \
LOAD_ARGS_##nr (args) \
register int _name asm ("ip") = _nametmp; \
asm volatile ("bl __libc_do_syscall" \
: "=r" (_a1) \
: "r" (_name) ASM_ARGS_##nr \
: "memory", "lr"); \
_a1; })
#else /* ARM */
#undef INTERNAL_SYSCALL_RAW
#define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \
({ \
register int _a1 asm ("r0"), _nr asm ("r7"); \
LOAD_ARGS_##nr (args) \
_nr = name; \
asm volatile ("swi 0x0 @ syscall " #name \
: "=r" (_a1) \
: "r" (_nr) ASM_ARGS_##nr \
: "memory"); \
_a1; })
#endif
/* For EABI, non-constant syscalls are actually pretty easy... */
#undef INTERNAL_SYSCALL_NCS
#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \
INTERNAL_SYSCALL_RAW (number, err, nr, args)
/* We must save and restore r7 (call-saved) for the syscall number.
We never make function calls from inside here (only potentially
signal handlers), so we do not bother with doubleword alignment.
Just like the APCS syscall convention, the EABI syscall convention uses
r0 through r6 for up to seven syscall arguments. None are ever passed to
the kernel on the stack, although incoming arguments are on the stack for
syscalls with five or more arguments.
The assembler will convert the literal pool load to a move for most
syscalls. */
#undef DO_CALL
#define DO_CALL(syscall_name, args) \
DOARGS_##args; \
ldr r7, =SYS_ify (syscall_name); \
swi 0x0; \
UNDOARGS_##args
#undef DOARGS_0
#define DOARGS_0 \
.fnstart; \
str r7, [sp, #-4]!; \
cfi_adjust_cfa_offset (4); \
cfi_rel_offset (r7, 0); \
.save { r7 }
#undef DOARGS_1
#define DOARGS_1 DOARGS_0
#undef DOARGS_2
#define DOARGS_2 DOARGS_0
#undef DOARGS_3
#define DOARGS_3 DOARGS_0
#undef DOARGS_4
#define DOARGS_4 DOARGS_0
#undef DOARGS_5
#define DOARGS_5 \
.fnstart; \
stmfd sp!, {r4, r7}; \
cfi_adjust_cfa_offset (8); \
cfi_rel_offset (r4, 0); \
cfi_rel_offset (r7, 4); \
.save { r4, r7 }; \
ldr r4, [sp, #8]
#undef DOARGS_6
#define DOARGS_6 \
.fnstart; \
mov ip, sp; \
stmfd sp!, {r4, r5, r7}; \
cfi_adjust_cfa_offset (12); \
cfi_rel_offset (r4, 0); \
cfi_rel_offset (r5, 4); \
cfi_rel_offset (r7, 8); \
.save { r4, r5, r7 }; \
ldmia ip, {r4, r5}
#undef DOARGS_7
#define DOARGS_7 \
.fnstart; \
mov ip, sp; \
stmfd sp!, {r4, r5, r6, r7}; \
cfi_adjust_cfa_offset (16); \
cfi_rel_offset (r4, 0); \
cfi_rel_offset (r5, 4); \
cfi_rel_offset (r6, 8); \
cfi_rel_offset (r7, 12); \
.save { r4, r5, r6, r7 }; \
ldmia ip, {r4, r5, r6}
#undef UNDOARGS_0
#define UNDOARGS_0 \
ldr r7, [sp], #4; \
cfi_adjust_cfa_offset (-4); \
cfi_restore (r7); \
.fnend
#undef UNDOARGS_1
#define UNDOARGS_1 UNDOARGS_0
#undef UNDOARGS_2
#define UNDOARGS_2 UNDOARGS_0
#undef UNDOARGS_3
#define UNDOARGS_3 UNDOARGS_0
#undef UNDOARGS_4
#define UNDOARGS_4 UNDOARGS_0
#undef UNDOARGS_5
#define UNDOARGS_5 \
ldmfd sp!, {r4, r7}; \
cfi_adjust_cfa_offset (-8); \
cfi_restore (r4); \
cfi_restore (r7); \
.fnend
#undef UNDOARGS_6
#define UNDOARGS_6 \
ldmfd sp!, {r4, r5, r7}; \
cfi_adjust_cfa_offset (-12); \
cfi_restore (r4); \
cfi_restore (r5); \
cfi_restore (r7); \
.fnend
#undef UNDOARGS_7
#define UNDOARGS_7 \
ldmfd sp!, {r4, r5, r6, r7}; \
cfi_adjust_cfa_offset (-16); \
cfi_restore (r4); \
cfi_restore (r5); \
cfi_restore (r6); \
cfi_restore (r7); \
.fnend
#endif /* _LINUX_ARM_EABI_SYSDEP_H */

View File

@ -1,126 +0,0 @@
/* Copyright (C) 1995, 1996, 1997, 1998, 2003, 2004, 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, see
<http://www.gnu.org/licenses/>. */
#include <sysdep-cancel.h>
#include <socketcall.h>
#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, $-4]!
#define PUSHARGS_2 stmfd sp!, {a1, a2}
#define PUSHARGS_3 stmfd sp!, {a1, a2, a3}
#define PUSHARGS_4 stmfd sp!, {a1, a2, a3, a4}
#define PUSHARGS_5 stmfd sp!, {a1, a2, a3, a4} /* Caller has already pushed arg 5 */
#define PUSHARGS_6 stmfd sp!, {a1, a2, a3, a4}
#define POPARGS_1 add sp, sp, #4
#define POPARGS_2 add sp, sp, #8
#define POPARGS_3 add sp, sp, #12
#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)
/* 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
swi SYS_ify(socketcall)
/* 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:
str lr, [sp, #-4]!
CENABLE
mov ip, r0
mov r0, #P(SOCKOP_,socket)
add r1, sp, #4
swi SYS_ify(socketcall)
str r0, [sp, #-4]!
mov r0, ip
CDISABLE
ldr r0, [sp], #4
ldr lr, [sp], #4
P(POPARGS_,NARGS)
/* r0 is < 0 if there was an error. */
cmn r0, $124
RETINSTR(cc, r14)
b PLTJMP(SYSCALL_ERROR)
#endif
PSEUDO_END (__socket)
#ifndef NO_WEAK_ALIAS
weak_alias (__socket, socket)
#endif

View File

@ -1,9 +1,36 @@
# File name Caller Syscall name # args Strong name Weak names
syscall - syscall 7 syscall
oldgetrlimit EXTRA getrlimit i:ip __old_getrlimit getrlimit@GLIBC_2.0
oldsetrlimit EXTRA setrlimit i:ip __old_setrlimit setrlimit@GLIBC_2.0
prlimit64 EXTRA prlimit64 i:iipp prlimit64
fanotify_mark EXTRA fanotify_mark i:iiiiis fanotify_mark
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
msgget - msgget i:ii __msgget msgget
msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
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
# 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

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1992, 93, 1995-2000, 2002, 2003, 2005, 2006, 2009
Free Software Foundation, Inc.
/* Copyright (C) 1992-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.
ARM changes by Philip Blundell, <pjb27@cam.ac.uk>, May 1997.
@ -29,6 +28,16 @@
#include <tls.h>
#if __NR_SYSCALL_BASE != 0
# 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
/* In order to get __set_errno() definition in INLINE_SYSCALL. */
#ifndef __ASSEMBLER__
#include <errno.h>
@ -163,8 +172,14 @@ __local_syscall_error: \
# define SYSCALL_ERROR __syscall_error
#endif
/* 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
with separate I-cache and D-cache. Make sure to use 0 for the SWI
argument; otherwise the (optional) compatibility code for APCS binaries
may be invoked. */
/* Linux takes system call args in registers:
syscall number in the SWI instruction
arg 1 r0
arg 2 r1
arg 3 r2
@ -190,58 +205,111 @@ __local_syscall_error: \
*/
/* We must save and restore r7 (call-saved) for the syscall number.
We never make function calls from inside here (only potentially
signal handlers), so we do not bother with doubleword alignment.
Just like the APCS syscall convention, the EABI syscall convention uses
r0 through r6 for up to seven syscall arguments. None are ever passed to
the kernel on the stack, although incoming arguments are on the stack for
syscalls with five or more arguments.
The assembler will convert the literal pool load to a move for most
syscalls. */
#undef DO_CALL
#define DO_CALL(syscall_name, args) \
DOARGS_##args; \
swi SYS_ify (syscall_name); \
ldr r7, =SYS_ify (syscall_name); \
swi 0x0; \
UNDOARGS_##args
#define DOARGS_0 /* nothing */
#define DOARGS_1 /* nothing */
#define DOARGS_2 /* nothing */
#define DOARGS_3 /* nothing */
#define DOARGS_4 /* nothing */
#define DOARGS_5 \
str r4, [sp, $-4]!; \
#undef DOARGS_0
#define DOARGS_0 \
.fnstart; \
str r7, [sp, #-4]!; \
cfi_adjust_cfa_offset (4); \
cfi_rel_offset (r4, 0); \
ldr r4, [sp, $4]
#define DOARGS_6 \
mov ip, sp; \
stmfd sp!, {r4, r5}; \
cfi_rel_offset (r7, 0); \
.save { r7 }
#undef DOARGS_1
#define DOARGS_1 DOARGS_0
#undef DOARGS_2
#define DOARGS_2 DOARGS_0
#undef DOARGS_3
#define DOARGS_3 DOARGS_0
#undef DOARGS_4
#define DOARGS_4 DOARGS_0
#undef DOARGS_5
#define DOARGS_5 \
.fnstart; \
stmfd sp!, {r4, r7}; \
cfi_adjust_cfa_offset (8); \
cfi_rel_offset (r4, 0); \
cfi_rel_offset (r5, 4); \
ldmia ip, {r4, r5}
#define DOARGS_7 \
cfi_rel_offset (r7, 4); \
.save { r4, r7 }; \
ldr r4, [sp, #8]
#undef DOARGS_6
#define DOARGS_6 \
.fnstart; \
mov ip, sp; \
stmfd sp!, {r4, r5, r6}; \
stmfd sp!, {r4, r5, r7}; \
cfi_adjust_cfa_offset (12); \
cfi_rel_offset (r4, 0); \
cfi_rel_offset (r5, 4); \
cfi_rel_offset (r7, 8); \
.save { r4, r5, r7 }; \
ldmia ip, {r4, r5}
#undef DOARGS_7
#define DOARGS_7 \
.fnstart; \
mov ip, sp; \
stmfd sp!, {r4, r5, r6, r7}; \
cfi_adjust_cfa_offset (16); \
cfi_rel_offset (r4, 0); \
cfi_rel_offset (r5, 4); \
cfi_rel_offset (r6, 8); \
cfi_rel_offset (r7, 12); \
.save { r4, r5, r6, r7 }; \
ldmia ip, {r4, r5, r6}
#define UNDOARGS_0 /* nothing */
#define UNDOARGS_1 /* nothing */
#define UNDOARGS_2 /* nothing */
#define UNDOARGS_3 /* nothing */
#define UNDOARGS_4 /* nothing */
#define UNDOARGS_5 \
ldr r4, [sp], $4; \
#undef UNDOARGS_0
#define UNDOARGS_0 \
ldr r7, [sp], #4; \
cfi_adjust_cfa_offset (-4); \
cfi_restore (r4)
#define UNDOARGS_6 \
ldmfd sp!, {r4, r5}; \
cfi_restore (r7); \
.fnend
#undef UNDOARGS_1
#define UNDOARGS_1 UNDOARGS_0
#undef UNDOARGS_2
#define UNDOARGS_2 UNDOARGS_0
#undef UNDOARGS_3
#define UNDOARGS_3 UNDOARGS_0
#undef UNDOARGS_4
#define UNDOARGS_4 UNDOARGS_0
#undef UNDOARGS_5
#define UNDOARGS_5 \
ldmfd sp!, {r4, r7}; \
cfi_adjust_cfa_offset (-8); \
cfi_restore (r4); \
cfi_restore (r5)
#define UNDOARGS_7 \
ldmfd sp!, {r4, r5, r6}; \
cfi_restore (r7); \
.fnend
#undef UNDOARGS_6
#define UNDOARGS_6 \
ldmfd sp!, {r4, r5, r7}; \
cfi_adjust_cfa_offset (-12); \
cfi_restore (r4); \
cfi_restore (r5); \
cfi_restore (r6)
cfi_restore (r7); \
.fnend
#undef UNDOARGS_7
#define UNDOARGS_7 \
ldmfd sp!, {r4, r5, r6, r7}; \
cfi_adjust_cfa_offset (-16); \
cfi_restore (r4); \
cfi_restore (r5); \
cfi_restore (r6); \
cfi_restore (r7); \
.fnend
#else /* not __ASSEMBLER__ */
@ -260,19 +328,46 @@ __local_syscall_error: \
#undef INTERNAL_SYSCALL_DECL
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
#if defined(__thumb__)
/* We can not expose the use of r7 to the compiler. GCC (as
of 4.5) uses r7 as the hard frame pointer for Thumb - although
for Thumb-2 it isn't obviously a better choice than r11.
And GCC does not support asms that conflict with the frame
pointer.
This would be easier if syscall numbers never exceeded 255,
but they do. For the moment the LOAD_ARGS_7 is sacrificed.
We can't use push/pop inside the asm because that breaks
unwinding (i.e. thread cancellation) for this frame. We can't
locally save and restore r7, because we do not know if this
function uses r7 or if it is our caller's r7; if it is our caller's,
then unwinding will fail higher up the stack. So we move the
syscall out of line and provide its own unwind information. */
# undef INTERNAL_SYSCALL_RAW
# define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \
({ unsigned int _sys_result; \
{ \
({ \
register int _a1 asm ("a1"); \
int _nametmp = name; \
LOAD_ARGS_##nr (args) \
asm volatile ("swi %1 @ syscall " #name \
register int _name asm ("ip") = _nametmp; \
asm volatile ("bl __libc_do_syscall" \
: "=r" (_a1) \
: "i" (name) ASM_ARGS_##nr \
: "r" (_name) ASM_ARGS_##nr \
: "memory", "lr"); \
_a1; })
#else /* ARM */
# undef INTERNAL_SYSCALL_RAW
# define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \
({ \
register int _a1 asm ("r0"), _nr asm ("r7"); \
LOAD_ARGS_##nr (args) \
_nr = name; \
asm volatile ("swi 0x0 @ syscall " #name \
: "=r" (_a1) \
: "r" (_nr) ASM_ARGS_##nr \
: "memory"); \
_sys_result = _a1; \
} \
(int) _sys_result; })
_a1; })
#endif
#undef INTERNAL_SYSCALL
#define INTERNAL_SYSCALL(name, err, nr, args...) \
@ -321,29 +416,18 @@ __local_syscall_error: \
LOAD_ARGS_5 (a1, a2, a3, a4, a5) \
register int _v2 asm ("v2") = _v2tmp;
#define ASM_ARGS_6 ASM_ARGS_5, "r" (_v2)
#ifndef __thumb__
# define LOAD_ARGS_7(a1, a2, a3, a4, a5, a6, a7) \
int _v3tmp = (int) (a7); \
LOAD_ARGS_6 (a1, a2, a3, a4, a5, a6) \
register int _v3 asm ("v3") = _v3tmp;
# define ASM_ARGS_7 ASM_ARGS_6, "r" (_v3)
#endif
/* We can't implement non-constant syscalls directly since the syscall
number is normally encoded in the instruction. So use SYS_syscall. */
/* For EABI, non-constant syscalls are actually pretty easy... */
#undef INTERNAL_SYSCALL_NCS
#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \
INTERNAL_SYSCALL_NCS_##nr (number, err, args)
#define INTERNAL_SYSCALL_NCS_0(number, err, args...) \
INTERNAL_SYSCALL (syscall, err, 1, number, args)
#define INTERNAL_SYSCALL_NCS_1(number, err, args...) \
INTERNAL_SYSCALL (syscall, err, 2, number, args)
#define INTERNAL_SYSCALL_NCS_2(number, err, args...) \
INTERNAL_SYSCALL (syscall, err, 3, number, args)
#define INTERNAL_SYSCALL_NCS_3(number, err, args...) \
INTERNAL_SYSCALL (syscall, err, 4, number, args)
#define INTERNAL_SYSCALL_NCS_4(number, err, args...) \
INTERNAL_SYSCALL (syscall, err, 5, number, args)
#define INTERNAL_SYSCALL_NCS_5(number, err, args...) \
INTERNAL_SYSCALL (syscall, err, 6, number, args)
INTERNAL_SYSCALL_RAW (number, err, nr, args)
#endif /* __ASSEMBLER__ */

View File

@ -1 +1 @@
#include <sysdeps/unix/sysv/linux/arm/eabi/readahead.c>
#include <sysdeps/unix/sysv/linux/arm/readahead.c>