about summary refs log tree commit diff
path: root/sysdeps/i386/i686
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/i386/i686')
-rw-r--r--sysdeps/i386/i686/Dist1
-rw-r--r--sysdeps/i386/i686/add_n.S10
-rw-r--r--sysdeps/i386/i686/dl-hash.h6
-rw-r--r--sysdeps/i386/i686/ffs.c4
-rw-r--r--sysdeps/i386/i686/hp-timing.h24
-rw-r--r--sysdeps/i386/i686/memcmp.S37
-rw-r--r--sysdeps/i386/i686/memcpy_chk.S2
-rw-r--r--sysdeps/i386/i686/memmove.S15
-rw-r--r--sysdeps/i386/i686/mempcpy.S6
-rw-r--r--sysdeps/i386/i686/memset.S24
-rw-r--r--sysdeps/i386/i686/memset_chk.S4
-rw-r--r--sysdeps/i386/i686/memusage.h22
-rw-r--r--sysdeps/i386/i686/strtok.S16
13 files changed, 132 insertions, 39 deletions
diff --git a/sysdeps/i386/i686/Dist b/sysdeps/i386/i686/Dist
deleted file mode 100644
index dbf11d5009..0000000000
--- a/sysdeps/i386/i686/Dist
+++ /dev/null
@@ -1 +0,0 @@
-hp-timing.c
diff --git a/sysdeps/i386/i686/add_n.S b/sysdeps/i386/i686/add_n.S
index e36b0d0a5d..3cce33acfe 100644
--- a/sysdeps/i386/i686/add_n.S
+++ b/sysdeps/i386/i686/add_n.S
@@ -1,6 +1,6 @@
 /* Add two limb vectors of the same length > 0 and store sum in a third
    limb vector.
-   Copyright (C) 1992, 94, 95, 97, 98, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1992,94,95,97,98,2000,2005 Free Software Foundation, Inc.
    This file is part of the GNU MP Library.
 
    The GNU MP Library is free software; you can redistribute it and/or modify
@@ -38,10 +38,14 @@ ENTRY (BP_SYM (__mpn_add_n))
 	ENTER
 
 	pushl %edi
+	cfi_adjust_cfa_offset (4)
 	pushl %esi
+	cfi_adjust_cfa_offset (4)
 
 	movl	RES(%esp),%edi
+	cfi_rel_offset (edi, 4)
 	movl	S1(%esp),%esi
+	cfi_rel_offset (esi, 0)
 	movl	S2(%esp),%edx
 	movl	SIZE(%esp),%ecx
 #if __BOUNDED_POINTERS__
@@ -107,7 +111,11 @@ L(oop):	movl	(%esi),%eax
 	negl	%eax
 
 	popl %esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl %edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	ret
diff --git a/sysdeps/i386/i686/dl-hash.h b/sysdeps/i386/i686/dl-hash.h
index 61183d80da..4bdd998aa8 100644
--- a/sysdeps/i386/i686/dl-hash.h
+++ b/sysdeps/i386/i686/dl-hash.h
@@ -1,5 +1,5 @@
 /* Compute hash alue for given string according to ELF standard.
-   Copyright (C) 1998, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -27,7 +27,7 @@
    would be much slower than the generic C implementation.  So don't
    use it.  */
 static unsigned int
-_dl_elf_hash (const unsigned char *name)
+_dl_elf_hash (const char *name)
 {
   unsigned int result;
   unsigned int temp0;
@@ -71,7 +71,7 @@ _dl_elf_hash (const unsigned char *name)
      "jnz 2b\n"
      "1:\t"
      : "=&r" (result), "=r" (name), "=&c" (temp0), "=&r" (temp1)
-     : "0" (0), "1" (name));
+     : "0" (0), "1" ((const unsigned char *) name));
 
   return result;
 }
diff --git a/sysdeps/i386/i686/ffs.c b/sysdeps/i386/i686/ffs.c
index fd7ef1a3d6..684ae21827 100644
--- a/sysdeps/i386/i686/ffs.c
+++ b/sysdeps/i386/i686/ffs.c
@@ -1,7 +1,7 @@
 /* ffs -- find first set bit in a word, counted from least significant end.
    For Intel 80x86, x>=6.
    This file is part of the GNU C Library.
-   Copyright (C) 1991, 92, 93, 94, 97, 98, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1991, 92, 93, 94, 97, 98, 2004, 2005 Free Software Foundation, Inc.
    Contributed by Ulrich Drepper <drepper@cygnus.com>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -45,5 +45,5 @@ libc_hidden_builtin_def (ffs)
 weak_alias (__ffs, ffsl)
 
 #else
-#include <sysdeps/generic/ffs.c>
+#include <string/ffs.c>
 #endif
diff --git a/sysdeps/i386/i686/hp-timing.h b/sysdeps/i386/i686/hp-timing.h
index a5906835f7..b924869649 100644
--- a/sysdeps/i386/i686/hp-timing.h
+++ b/sysdeps/i386/i686/hp-timing.h
@@ -1,5 +1,5 @@
 /* High precision, low overhead timing functions.  i686 version.
-   Copyright (C) 1998, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -119,26 +119,24 @@ typedef unsigned long long int hp_timing_t;
 /* We have to jump through hoops to get this correctly implemented.  */
 #define HP_TIMING_ACCUM(Sum, Diff) \
   do {									      \
-    char __not_done;							      \
+    int __not_done;							      \
     hp_timing_t __oldval = (Sum);					      \
     hp_timing_t __diff = (Diff) - GLRO(dl_hp_timing_overhead);		      \
     do									      \
       {									      \
 	hp_timing_t __newval = __oldval + __diff;			      \
 	int __temp0, __temp1;						      \
-	__asm__ __volatile__ ("xchgl %4, %%ebx\n\t"			      \
+	__asm__ __volatile__ ("xchgl %0, %%ebx\n\t"			      \
 			      "lock; cmpxchg8b %1\n\t"			      \
-			      "sete %0\n\t"				      \
-			      "movl %4, %%ebx"				      \
-			      : "=q" (__not_done), "=m" (Sum),		      \
-				"=A" (__oldval), "=c" (__temp0),	      \
-				"=SD" (__temp1)				      \
-			      : "1" (Sum), "2" (__oldval),		      \
-				"3" (__newval >> 32),			      \
-				"4" (__newval & 0xffffffff)		      \
-			      : "memory");				      \
+			      "sete %%bl\n\t"				      \
+			      "xchgl %0, %%ebx"				      \
+			      : "=SD" (__not_done), "=m" (Sum),		      \
+				"=A" (__oldval), "=c" (__temp0)		      \
+			      : "m" (Sum), "2" (__oldval),		      \
+				"3" ((unsigned int) (__newval >> 32)),	      \
+				"0" ((unsigned int) __newval));		      \
       }									      \
-    while (__not_done);							      \
+    while ((unsigned char) __not_done);					      \
   } while (0)
 
 /* No threads, no extra work.  */
diff --git a/sysdeps/i386/i686/memcmp.S b/sysdeps/i386/i686/memcmp.S
index ef57acdee8..4bd5394bec 100644
--- a/sysdeps/i386/i686/memcmp.S
+++ b/sysdeps/i386/i686/memcmp.S
@@ -1,5 +1,5 @@
 /* Compare two memory blocks for differences in the first COUNT bytes.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 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
@@ -26,8 +26,11 @@
 #define BLK1		PARMS
 #define BLK2		BLK1+PTR_SIZE
 #define LEN		BLK2+PTR_SIZE
-#define ENTRANCE	pushl %ebx; ENTER
-#define RETURN		popl %ebx; LEAVE; ret
+#define ENTRANCE	pushl %ebx; cfi_adjust_cfa_offset (4); \
+			cfi_rel_offset (ebx, 0); ENTER
+#define RETURN		popl %ebx; cfi_adjust_cfa_offset (-4); \
+			cfi_restore (ebx); LEAVE; ret; \
+			cfi_adjust_cfa_offset (4); cfi_rel_offset (ebx, 0);
 
 /* Load an entry in a jump table into EBX.  TABLE is a jump table
    with relative offsets.  INDEX is a register contains the index
@@ -77,11 +80,15 @@ L(neq):
 	sbbl	$-1, %eax
 	RETURN
 
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (ebx, 0)
 L(not_1):
 	jl	L(bye)			/* LEN == 0  */
 
 	pushl	%esi
+	cfi_adjust_cfa_offset (4)
 	movl	%eax, %esi
+	cfi_rel_offset (esi, 0)
 	cmpl	$32, %ecx;
 	jge	L(32bytesormore)	/* LEN => 32  */
 
@@ -128,9 +135,14 @@ L(4bytes):
 	jne	L(find_diff)
 L(0bytes):
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	xorl	%eax, %eax
 	RETURN
 
+	cfi_adjust_cfa_offset (8)
+	cfi_rel_offset (esi, 0)
+	cfi_rel_offset (ebx, 4)
 L(29bytes):
 	movl	-29(%esi), %eax
 	movl	-29(%edx), %ecx
@@ -171,9 +183,14 @@ L(1bytes):
 	cmpb	-1(%edx), %al
 	jne	L(set)
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	xorl	%eax, %eax
 	RETURN
 
+	cfi_adjust_cfa_offset (8)
+	cfi_rel_offset (esi, 0)
+	cfi_rel_offset (ebx, 4)
 L(30bytes):
 	movl	-30(%esi), %eax
 	movl	-30(%edx), %ecx
@@ -217,9 +234,14 @@ L(2bytes):
 	cmpl	%ecx, %eax
 	jne	L(set)
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	xorl	%eax, %eax
 	RETURN
 
+	cfi_adjust_cfa_offset (8)
+	cfi_rel_offset (esi, 0)
+	cfi_rel_offset (ebx, 4)
 L(31bytes):
 	movl	-31(%esi), %eax
 	movl	-31(%edx), %ecx
@@ -266,9 +288,14 @@ L(3bytes):
 	cmpb	-1(%edx), %al
 	jne	L(set)
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	xorl	%eax, %eax
 	RETURN
 
+	cfi_adjust_cfa_offset (8)
+	cfi_rel_offset (esi, 0)
+	cfi_rel_offset (ebx, 4)
 	ALIGN (4)
 /* ECX >= 32.  */
 L(32bytesormore):
@@ -349,7 +376,10 @@ L(set):
 	sbbl	%eax, %eax
 	sbbl	$-1, %eax
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	RETURN
+END (BP_SYM (memcmp))
 
 	.section	.rodata
 	ALIGN (2)
@@ -387,7 +417,6 @@ L(table_32bytes) :
 	.long	L(30bytes) - . + 0x78
 	.long	L(31bytes) - . + 0x7c
 
-END (BP_SYM (memcmp))
 
 #undef bcmp
 weak_alias (BP_SYM (memcmp), BP_SYM (bcmp))
diff --git a/sysdeps/i386/i686/memcpy_chk.S b/sysdeps/i386/i686/memcpy_chk.S
index 561263f9bf..2893911cd2 100644
--- a/sysdeps/i386/i686/memcpy_chk.S
+++ b/sysdeps/i386/i686/memcpy_chk.S
@@ -1,4 +1,4 @@
-/* Checking memcpy for x86-64.
+/* Checking memcpy for i686.
    Copyright (C) 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
diff --git a/sysdeps/i386/i686/memmove.S b/sysdeps/i386/i686/memmove.S
index 951e139ad4..b93b5c729f 100644
--- a/sysdeps/i386/i686/memmove.S
+++ b/sysdeps/i386/i686/memmove.S
@@ -1,7 +1,7 @@
 /* Copy memory block and return pointer to beginning of destination block
    For Intel 80x86, x>=6.
    This file is part of the GNU C Library.
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 2003.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -42,11 +42,14 @@ ENTRY (BP_SYM (memmove))
 	ENTER
 
 	pushl	%edi
+	cfi_adjust_cfa_offset (4)
 
 	movl	LEN(%esp), %ecx
 	movl	DEST(%esp), %edi
+	cfi_rel_offset (edi, 0)
 	movl	%esi, %edx
 	movl	SRC(%esp), %esi
+	cfi_register (esi, edx)
 	CHECK_BOUNDS_BOTH_WIDE (%edi, DEST(%esp), %ecx)
 	CHECK_BOUNDS_BOTH_WIDE (%esi, SRC(%esp), %ecx)
 
@@ -65,14 +68,21 @@ ENTRY (BP_SYM (memmove))
 2:	rep
 	movsl
 	movl	%edx, %esi
+	cfi_restore (esi)
 	movl	DEST(%esp), %eax
 	RETURN_BOUNDED_POINTER (DEST(%esp))
 
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	RET_PTR
 
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (edi, 0)
+	cfi_register (esi, edx)
+
 	/* Backward copying.  */
 3:	std
 	leal	-1(%edi, %ecx), %edi
@@ -90,11 +100,14 @@ ENTRY (BP_SYM (memmove))
 	rep
 	movsl
 	movl	%edx, %esi
+	cfi_restore (esi)
 	movl	DEST(%esp), %eax
 	RETURN_BOUNDED_POINTER (DEST(%esp))
 
 	cld
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	RET_PTR
diff --git a/sysdeps/i386/i686/mempcpy.S b/sysdeps/i386/i686/mempcpy.S
index 843a35823a..6437e4a5d4 100644
--- a/sysdeps/i386/i686/mempcpy.S
+++ b/sysdeps/i386/i686/mempcpy.S
@@ -1,7 +1,7 @@
 /* Copy memory block and return pointer to following byte.
    For Intel 80x86, x>=6.
    This file is part of the GNU C Library.
-   Copyright (C) 1998, 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1998,1999,2000,2002,2004,2005 Free Software Foundation, Inc.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -43,9 +43,11 @@ ENTRY (BP_SYM (__mempcpy))
 
 	movl	LEN(%esp), %ecx
 	movl	%edi, %eax
+	cfi_register (edi, eax)
 	movl	DEST(%esp), %edi
 	CHECK_BOUNDS_BOTH_WIDE (%edi, DEST(%esp), %ecx)
 	movl	%esi, %edx
+	cfi_register (esi, edx)
 	movl	SRC(%esp), %esi
 	CHECK_BOUNDS_BOTH_WIDE (%esi, SRC(%esp), %ecx)
 	cld
@@ -58,7 +60,9 @@ ENTRY (BP_SYM (__mempcpy))
 2:	rep
 	movsl
 	xchgl	%edi, %eax
+	cfi_restore (edi)
 	movl	%edx, %esi
+	cfi_restore (esi)
 	RETURN_BOUNDED_POINTER (DEST(%esp))
 
 	LEAVE
diff --git a/sysdeps/i386/i686/memset.S b/sysdeps/i386/i686/memset.S
index 561188ffec..dfa1aa7019 100644
--- a/sysdeps/i386/i686/memset.S
+++ b/sysdeps/i386/i686/memset.S
@@ -1,6 +1,6 @@
 /* memset/bzero -- set memory area to CH/0
    Highly optimized version for ix86, x>=6.
-   Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999,2000,2003,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
@@ -51,6 +51,7 @@ ENTRY (BP_SYM (memset))
 
 	cld
 	pushl	%edi
+	cfi_adjust_cfa_offset (4)
 	movl	DEST(%esp), %edx
 	movl	LEN(%esp), %ecx
 	CHECK_BOUNDS_BOTH_WIDE (%edx, DEST(%esp), %ecx)
@@ -61,18 +62,19 @@ ENTRY (BP_SYM (memset))
 #endif
 	jecxz	1f
 	movl	%edx, %edi
+	cfi_rel_offset (edi, 0)
 	andl	$3, %edx
-	jz	2f
-	jnp	3f
-	stosb
+	jz	2f	/* aligned */
+	jp	3f	/* misaligned at 3, store just one byte below */
+	stosb		/* misaligned at 1 or 2, store two bytes */
 	decl	%ecx
 	jz	1f
 3:	stosb
 	decl	%ecx
 	jz	1f
-	xorl	$3, %edx
-	jz	2f
-	stosb
+	xorl	$1, %edx
+	jnz	2f	/* was misaligned at 2 or 3, now aligned */
+	stosb		/* was misaligned at 1, store third byte */
 	decl	%ecx
 2:	movl	%ecx, %edx
 	shrl	$2, %ecx
@@ -92,6 +94,8 @@ ENTRY (BP_SYM (memset))
 	RETURN_BOUNDED_POINTER (DEST(%esp))
 #endif
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 #if BZERO_P
@@ -101,3 +105,9 @@ ENTRY (BP_SYM (memset))
 #endif
 END (BP_SYM (memset))
 libc_hidden_builtin_def (memset)
+
+#if defined PIC && !defined NOT_IN_libc && !BZERO_P
+strong_alias (__memset_chk, __memset_zero_constant_len_parameter)
+	.section .gnu.warning.__memset_zero_constant_len_parameter
+	.string "memset used with constant zero length parameter; this could be due to transposed parameters"
+#endif
diff --git a/sysdeps/i386/i686/memset_chk.S b/sysdeps/i386/i686/memset_chk.S
index d178654994..cd93d5ee10 100644
--- a/sysdeps/i386/i686/memset_chk.S
+++ b/sysdeps/i386/i686/memset_chk.S
@@ -1,5 +1,5 @@
-/* Checking memset for x86-64.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+/* Checking memset for i686.
+   Copyright (C) 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
diff --git a/sysdeps/i386/i686/memusage.h b/sysdeps/i386/i686/memusage.h
new file mode 100644
index 0000000000..235c3fc725
--- /dev/null
+++ b/sysdeps/i386/i686/memusage.h
@@ -0,0 +1,22 @@
+/* Copyright (C) 2000, 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.  */
+
+#define GETSP() ({ register uintptr_t stack_ptr asm ("esp"); stack_ptr; })
+#define GETTIME(low,high) asm ("rdtsc" : "=a" (low), "=d" (high))
+
+#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/i386/i686/strtok.S b/sysdeps/i386/i686/strtok.S
index 3d81fb6d42..fe225e5485 100644
--- a/sysdeps/i386/i686/strtok.S
+++ b/sysdeps/i386/i686/strtok.S
@@ -1,6 +1,6 @@
 /* strtok (str, delim) -- Return next DELIM separated token from STR.
    For Intel 80686.
-   Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000, 2001, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -86,6 +86,8 @@ ENTRY (BP_SYM (FUNCTION))
 
 #if !defined USE_AS_STRTOK_R && defined PIC
 	pushl %ebx			/* Save PIC register.  */
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (ebx, 0)
 	call 0b
 	addl $_GLOBAL_OFFSET_TABLE_, %ebx
 #endif
@@ -97,6 +99,7 @@ ENTRY (BP_SYM (FUNCTION))
 	   table.  */
 	movl %edi, %edx
 	subl $256, %esp
+	cfi_adjust_cfa_offset (256)
 	movl $64, %ecx
 	movl %esp, %edi
 	xorl %eax, %eax
@@ -247,9 +250,9 @@ L(8):	cmpl %eax, %edx
 	cmovne %ecx, %edx
 
 	/* Store the pointer to the next character.  */
-# ifdef USE_AS_STRTOK_R
+#ifdef USE_AS_STRTOK_R
 	movl SAVE(%esp), %ecx
-# endif
+#endif
 	movl %edx, SAVE_PTR
 	CHECK_BOUNDS_HIGH (%edx, SAVE_PTR, jb)
 	RETURN_BOUNDED_POINTER (SAVE_PTR)
@@ -257,14 +260,21 @@ L(8):	cmpl %eax, %edx
 L(epilogue):
 	/* Remove the stopset table.  */
 	addl $256, %esp
+	cfi_adjust_cfa_offset (-256)
 #if !defined USE_AS_STRTOK_R && defined PIC
 	popl %ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 #endif
 	LEAVE
 	RET_PTR
 
 L(returnNULL):
 	xorl %eax, %eax
+#ifdef USE_AS_STRTOK_R
+	movl SAVE(%esp), %ecx
+#endif
+	movl %edx, SAVE_PTR
 	RETURN_NULL_BOUNDED_POINTER
 	jmp L(epilogue)