diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/powerpc/powerpc32/elf/start.S | 4 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc64/elf/start.S | 4 | ||||
-rw-r--r-- | sysdeps/sparc/sparc32/elf/start.S | 4 | ||||
-rw-r--r-- | sysdeps/sparc/sparc64/elf/start.S | 4 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/kernel-features.h | 3 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/preadv.c | 13 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/pwritev.c | 13 | ||||
-rw-r--r-- | sysdeps/x86_64/memchr.S | 3 | ||||
-rw-r--r-- | sysdeps/x86_64/rawmemchr.S | 54 | ||||
-rw-r--r-- | sysdeps/x86_64/strrchr.S | 81 |
10 files changed, 168 insertions, 15 deletions
diff --git a/sysdeps/powerpc/powerpc32/elf/start.S b/sysdeps/powerpc/powerpc32/elf/start.S index bafd2ae001..a8abdca0c6 100644 --- a/sysdeps/powerpc/powerpc32/elf/start.S +++ b/sysdeps/powerpc/powerpc32/elf/start.S @@ -1,5 +1,6 @@ /* Startup code for programs linked with GNU libc. - Copyright (C) 1998,1999,2000,2001,2002,2003 Free Software Foundation, Inc. + Copyright (C) 1998,1999,2000,2001,2002,2003,2009 + 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 @@ -98,4 +99,5 @@ END(_start) .section ".data" .globl __data_start __data_start: + .long 0 weak_alias (__data_start, data_start) diff --git a/sysdeps/powerpc/powerpc64/elf/start.S b/sysdeps/powerpc/powerpc64/elf/start.S index c9119a2624..e559b87841 100644 --- a/sysdeps/powerpc/powerpc64/elf/start.S +++ b/sysdeps/powerpc/powerpc64/elf/start.S @@ -1,5 +1,6 @@ /* Startup code for programs linked with GNU libc. PowerPC64 version. - Copyright (C) 1998,1999,2000,2001,2002,2003 Free Software Foundation, Inc. + Copyright (C) 1998,1999,2000,2001,2002,2003,2009 + 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 @@ -83,4 +84,5 @@ END(_start) .section ".data" .globl __data_start __data_start: + .long 0 weak_alias (__data_start, data_start) diff --git a/sysdeps/sparc/sparc32/elf/start.S b/sysdeps/sparc/sparc32/elf/start.S index 85adb7322f..7ff4bd68f6 100644 --- a/sysdeps/sparc/sparc32/elf/start.S +++ b/sysdeps/sparc/sparc32/elf/start.S @@ -1,5 +1,6 @@ /* Startup code for elf32-sparc - Copyright (C) 1997, 1998, 2002, 2004, 2007 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 2002, 2004, 2007, 2009 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997. @@ -96,4 +97,5 @@ _start: .data .globl __data_start __data_start: + .long 0 weak_alias (__data_start, data_start) diff --git a/sysdeps/sparc/sparc64/elf/start.S b/sysdeps/sparc/sparc64/elf/start.S index 650d3d3048..406ea0f55e 100644 --- a/sysdeps/sparc/sparc64/elf/start.S +++ b/sysdeps/sparc/sparc64/elf/start.S @@ -1,5 +1,6 @@ /* Startup code for elf64-sparc - Copyright (C) 1997, 1998, 2002, 2004, 2007 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 2002, 2004, 2007, 2009 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997. @@ -97,4 +98,5 @@ _start: .data .globl __data_start __data_start: + .long 0 weak_alias (__data_start, data_start) diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h index 5f1ffdb9c5..2fa8524db9 100644 --- a/sysdeps/unix/sysv/linux/kernel-features.h +++ b/sysdeps/unix/sysv/linux/kernel-features.h @@ -532,7 +532,8 @@ /* Support for preadv and pwritev was added in 2.6.30. */ #if __LINUX_KERNEL_VERSION >= 0x02061e \ - && (defined __i386__ || defined __x86_64__ || defined __powerpc__) + && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \ + || defined __ia64__ || defined __sparc__ && defined __sh__) # define __ASSUME_PREADV 1 # define __ASSUME_PWRITEV 1 #endif diff --git a/sysdeps/unix/sysv/linux/preadv.c b/sysdeps/unix/sysv/linux/preadv.c index e2f8238596..0d4a6c3803 100644 --- a/sysdeps/unix/sysv/linux/preadv.c +++ b/sysdeps/unix/sysv/linux/preadv.c @@ -29,6 +29,7 @@ #include <sys/syscall.h> #include <kernel-features.h> + #ifndef PREADV # define PREADV preadv # define PREADV_REPLACEMENT __atomic_preadv_replacement @@ -36,8 +37,10 @@ # define OFF_T off_t #endif +#ifndef __ASSUME_PREADV static ssize_t PREADV_REPLACEMENT (int, __const struct iovec *, int, OFF_T) internal_function; +#endif ssize_t @@ -51,14 +54,16 @@ PREADV (fd, vector, count, offset) ssize_t result; if (SINGLE_THREAD_P) - result = INLINE_SYSCALL (preadv, 5, fd, vector, count, offset >> 32, - offset & 0xffffffff); + result = INLINE_SYSCALL (preadv, 5, fd, vector, count, + (off_t) ((off64_t) offset >> 32), + (off_t) (offset & 0xffffffff)); else { int oldtype = LIBC_CANCEL_ASYNC (); - result = INLINE_SYSCALL (preadv, 5, fd, vector, count, offset >> 32, - offset & 0xffffffff); + result = INLINE_SYSCALL (preadv, 5, fd, vector, count, + (off_t) ((off64_t) offset >> 32), + (off_t) (offset & 0xffffffff)); LIBC_CANCEL_RESET (oldtype); } diff --git a/sysdeps/unix/sysv/linux/pwritev.c b/sysdeps/unix/sysv/linux/pwritev.c index df430ffe46..5c30eae51f 100644 --- a/sysdeps/unix/sysv/linux/pwritev.c +++ b/sysdeps/unix/sysv/linux/pwritev.c @@ -29,6 +29,7 @@ #include <sys/syscall.h> #include <kernel-features.h> + #ifndef PWRITEV # define PWRITEV pwritev # define PWRITEV_REPLACEMENT __atomic_pwritev_replacement @@ -36,8 +37,10 @@ # define OFF_T off_t #endif +#ifndef __ASSUME_PWRITEV static ssize_t PWRITEV_REPLACEMENT (int, __const struct iovec *, int, OFF_T) internal_function; +#endif ssize_t @@ -51,14 +54,16 @@ PWRITEV (fd, vector, count, offset) ssize_t result; if (SINGLE_THREAD_P) - result = INLINE_SYSCALL (pwritev, 5, fd, vector, count, offset >> 32, - offset & 0xffffffff); + result = INLINE_SYSCALL (pwritev, 5, fd, vector, count, + (off_t) ((off64_t) offset >> 32), + (off_t) (offset & 0xffffffff)); else { int oldtype = LIBC_CANCEL_ASYNC (); - result = INLINE_SYSCALL (pwritev, 5, fd, vector, count, offset >> 32, - offset & 0xffffffff); + result = INLINE_SYSCALL (pwritev, 5, fd, vector, count, + (off_t) ((off64_t) offset >> 32), + (off_t) (offset & 0xffffffff)); LIBC_CANCEL_RESET (oldtype); } diff --git a/sysdeps/x86_64/memchr.S b/sysdeps/x86_64/memchr.S index 644362d565..09ba6d4f8d 100644 --- a/sysdeps/x86_64/memchr.S +++ b/sysdeps/x86_64/memchr.S @@ -1,5 +1,4 @@ -/* strlen(str) -- determine the length of the string STR. - Copyright (C) 2009 Free Software Foundation, Inc. +/* Copyright (C) 2009 Free Software Foundation, Inc. Contributed by Ulrich Drepper <drepper@redhat.com>. This file is part of the GNU C Library. diff --git a/sysdeps/x86_64/rawmemchr.S b/sysdeps/x86_64/rawmemchr.S new file mode 100644 index 0000000000..c3bd771635 --- /dev/null +++ b/sysdeps/x86_64/rawmemchr.S @@ -0,0 +1,54 @@ +/* Copyright (C) 2009 Free Software Foundation, Inc. + Contributed by Ulrich Drepper <drepper@redhat.com>. + 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 <sysdep.h> + + + .text +ENTRY (rawmemchr) + movd %esi, %xmm1 + movq %rdi, %rcx + punpcklbw %xmm1, %xmm1 + andq $~15, %rdi + punpcklbw %xmm1, %xmm1 + orl $0xffffffff, %esi + movdqa (%rdi), %xmm0 + pshufd $0, %xmm1, %xmm1 + subq %rdi, %rcx + pcmpeqb %xmm1, %xmm0 + shl %cl, %esi + pmovmskb %xmm0, %ecx + leaq 16(%rdi), %rdi + andl %esi, %ecx + jnz 1f + +2: movdqa (%rdi), %xmm0 + leaq 16(%rdi), %rdi + pcmpeqb %xmm1, %xmm0 + pmovmskb %xmm0, %ecx + testl %ecx, %ecx + jz 2b + +1: bsfl %ecx, %ecx + leaq -16(%rcx,%rdi), %rax + ret +END (rawmemchr) + +strong_alias (rawmemchr, __rawmemchr) +libc_hidden_builtin_def (__rawmemchr) diff --git a/sysdeps/x86_64/strrchr.S b/sysdeps/x86_64/strrchr.S new file mode 100644 index 0000000000..c75b485ca3 --- /dev/null +++ b/sysdeps/x86_64/strrchr.S @@ -0,0 +1,81 @@ +/* strrchr (str, ch) -- Return pointer to last occurrence of CH in STR. + For AMD x86-64. + Copyright (C) 2009 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 <sysdep.h> + + + .text +ENTRY (strrchr) + movd %esi, %xmm1 + movq %rdi, %rcx + punpcklbw %xmm1, %xmm1 + andq $~15, %rdi + pxor %xmm2, %xmm2 + punpcklbw %xmm1, %xmm1 + orl $0xffffffff, %esi + movdqa (%rdi), %xmm0 + pshufd $0, %xmm1, %xmm1 + subq %rdi, %rcx + movdqa %xmm0, %xmm3 + leaq 16(%rdi), %rdi + pcmpeqb %xmm1, %xmm0 + pcmpeqb %xmm2, %xmm3 + shl %cl, %esi + pmovmskb %xmm0, %edx + pmovmskb %xmm3, %ecx + andl %esi, %edx + andl %esi, %ecx + xorl %eax, %eax + movl %edx, %esi + orl %ecx, %esi + jnz 1f + +2: movdqa (%rdi), %xmm0 + leaq 16(%rdi), %rdi + movdqa %xmm0, %xmm3 + pcmpeqb %xmm1, %xmm0 + pcmpeqb %xmm2, %xmm3 + pmovmskb %xmm0, %edx + pmovmskb %xmm3, %ecx + movl %edx, %esi + orl %ecx, %esi + jz 2b + +1: bsfl %ecx, %r9d + movl $0xffffffff, %r8d + movl $31, %ecx + jnz 5f + + bsrl %edx, %edx + jz 2b + leaq -16(%rdi,%rdx), %rax + jmp 2b + +5: subl %r9d, %ecx + shrl %cl, %r8d + andl %r8d, %edx + bsrl %edx, %edx + jz 4f + leaq -16(%rdi,%rdx), %rax +4: ret +END (strrchr) + +weak_alias (strrchr, rindex) +libc_hidden_builtin_def (strrchr) |