about summary refs log tree commit diff
path: root/sysdeps/i386/i686
diff options
context:
space:
mode:
authorGreg McGary <greg@mcgary.org>2000-06-09 06:14:39 +0000
committerGreg McGary <greg@mcgary.org>2000-06-09 06:14:39 +0000
commit3f02f778cdbec7d95e0a9d6f9368ce9cda0a6d03 (patch)
treea193d5f40640e64b7b6555e831772c1934e2a8d0 /sysdeps/i386/i686
parenta40fb915f89d0e225058c0865de4504f83f90173 (diff)
downloadglibc-3f02f778cdbec7d95e0a9d6f9368ce9cda0a6d03.tar.gz
glibc-3f02f778cdbec7d95e0a9d6f9368ce9cda0a6d03.tar.xz
glibc-3f02f778cdbec7d95e0a9d6f9368ce9cda0a6d03.zip
* sysdeps/i386/bp-asm.h: New file.
* sysdeps/i386/__longjmp.S: Define & use symbolic argument stack 
offsets.  Add ENTER/LEAVE macros for optionally maintaining 
frame-pointer chain when debugging. 
* sysdeps/i386/add_n.S: Likewise. 
* sysdeps/i386/addmul_1.S: Likewise. 
* sysdeps/i386/lshift.S: Likewise. 
* sysdeps/i386/memchr.S: Likewise. 
* sysdeps/i386/memcmp.S: Likewise. 
* sysdeps/i386/mul_1.S: Likewise. 
* sysdeps/i386/rawmemchr.S: Likewise. 
* sysdeps/i386/rshift.S: Likewise. 
* sysdeps/i386/stpcpy.S: Likewise. 
* sysdeps/i386/stpncpy.S: Likewise. 
* sysdeps/i386/strchr.S: Likewise. 
* sysdeps/i386/strchrnul.S: Likewise. 
* sysdeps/i386/strcspn.S: Likewise. 
* sysdeps/i386/strpbrk.S: Likewise. 
* sysdeps/i386/strrchr.S: Likewise. 
* sysdeps/i386/strspn.S: Likewise. 
* sysdeps/i386/strtok.S: Likewise. 
* sysdeps/i386/sub_n.S: Likewise. 
* sysdeps/i386/submul_1.S: Likewise. 
* sysdeps/i386/elf/setjmp.S: Likewise. 
* sysdeps/i386/i486/strcat.S: Likewise. 
* sysdeps/i386/i486/strlen.S: Likewise. 
* sysdeps/i386/i586/add_n.S: Likewise. 
* sysdeps/i386/i586/lshift.S: Likewise. 
* sysdeps/i386/i586/memcpy.S: Likewise. 
* sysdeps/i386/i586/memset.S: Likewise. 
* sysdeps/i386/i586/rshift.S: Likewise. 
* sysdeps/i386/i586/strchr.S: Likewise. 
* sysdeps/i386/i586/strcpy.S: Likewise. 
* sysdeps/i386/i586/strlen.S: Likewise. 
* sysdeps/i386/i586/sub_n.S: Likewise. 
* sysdeps/i386/i686/add_n.S: Likewise. 
* sysdeps/i386/i686/memcpy.S: Likewise. 
* sysdeps/i386/i686/mempcpy.S: Likewise. 
* sysdeps/i386/i686/memset.S: Likewise. 
* sysdeps/i386/i686/strcmp.S: Likewise.
2000-06-08  Greg McGary  <greg@mcgary.org>

	* sysdeps/i386/bp-asm.h: New file.
	* sysdeps/i386/__longjmp.S: Define & use symbolic argument stack
	offsets.  Add ENTER/LEAVE macros for optionally maintaining
	frame-pointer chain when debugging.
	* sysdeps/i386/add_n.S: Likewise.
	* sysdeps/i386/addmul_1.S: Likewise.
	* sysdeps/i386/lshift.S: Likewise.
	* sysdeps/i386/memchr.S: Likewise.
	* sysdeps/i386/memcmp.S: Likewise.
	* sysdeps/i386/mul_1.S: Likewise.
	* sysdeps/i386/rawmemchr.S: Likewise.
	* sysdeps/i386/rshift.S: Likewise.
	* sysdeps/i386/stpcpy.S: Likewise.
	* sysdeps/i386/stpncpy.S: Likewise.
	* sysdeps/i386/strchr.S: Likewise.
	* sysdeps/i386/strchrnul.S: Likewise.
	* sysdeps/i386/strcspn.S: Likewise.
	* sysdeps/i386/strpbrk.S: Likewise.
	* sysdeps/i386/strrchr.S: Likewise.
	* sysdeps/i386/strspn.S: Likewise.
	* sysdeps/i386/strtok.S: Likewise.
	* sysdeps/i386/sub_n.S: Likewise.
	* sysdeps/i386/submul_1.S: Likewise.
	* sysdeps/i386/elf/setjmp.S: Likewise.
	* sysdeps/i386/i486/strcat.S: Likewise.
	* sysdeps/i386/i486/strlen.S: Likewise.
	* sysdeps/i386/i586/add_n.S: Likewise.
	* sysdeps/i386/i586/lshift.S: Likewise.
	* sysdeps/i386/i586/memcpy.S: Likewise.
	* sysdeps/i386/i586/memset.S: Likewise.
	* sysdeps/i386/i586/rshift.S: Likewise.
	* sysdeps/i386/i586/strchr.S: Likewise.
	* sysdeps/i386/i586/strcpy.S: Likewise.
	* sysdeps/i386/i586/strlen.S: Likewise.
	* sysdeps/i386/i586/sub_n.S: Likewise.
	* sysdeps/i386/i686/add_n.S: Likewise.
	* sysdeps/i386/i686/memcpy.S: Likewise.
	* sysdeps/i386/i686/mempcpy.S: Likewise.
	* sysdeps/i386/i686/memset.S: Likewise.
	* sysdeps/i386/i686/strcmp.S: Likewise.
Diffstat (limited to 'sysdeps/i386/i686')
-rw-r--r--sysdeps/i386/i686/add_n.S27
-rw-r--r--sysdeps/i386/i686/memcpy.S29
-rw-r--r--sysdeps/i386/i686/mempcpy.S27
-rw-r--r--sysdeps/i386/i686/memset.S47
-rw-r--r--sysdeps/i386/i686/strcmp.S37
5 files changed, 99 insertions, 68 deletions
diff --git a/sysdeps/i386/i686/add_n.S b/sysdeps/i386/i686/add_n.S
index 5a1339f9f8..45e1284b1b 100644
--- a/sysdeps/i386/i686/add_n.S
+++ b/sysdeps/i386/i686/add_n.S
@@ -18,16 +18,15 @@
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
    MA 02111-1307, USA. */
 
-/*
-  INPUT PARAMETERS
-  res_ptr	(sp + 4)
-  s1_ptr	(sp + 8)
-  s2_ptr	(sp + 12)
-  size		(sp + 16)
-*/
-
 #include "sysdep.h"
 #include "asm-syntax.h"
+#include "bp-asm.h"
+
+#define PARMS	LINKAGE+8		/* space for 2 saved regs */
+#define RES	PARMS
+#define S1	RES+PTR_SIZE
+#define S2	S1+PTR_SIZE
+#define SIZE	S2+PTR_SIZE
 
 	.text
 #ifdef PIC
@@ -35,13 +34,15 @@ L(1):	addl    (%esp), %eax
 	ret
 #endif
 ENTRY(__mpn_add_n)
+	ENTER
+
 	pushl %edi
 	pushl %esi
 
-	movl 12(%esp),%edi		/* res_ptr */
-	movl 16(%esp),%esi		/* s1_ptr */
-	movl 20(%esp),%edx		/* s2_ptr */
-	movl 24(%esp),%ecx		/* size */
+	movl	RES(%esp),%edi
+	movl	S1(%esp),%esi
+	movl	S2(%esp),%edx
+	movl	SIZE(%esp),%ecx
 
 	movl	%ecx,%eax
 	shrl	$3,%ecx			/* compute count for unrolled loop */
@@ -100,5 +101,7 @@ L(oop):	movl	(%esi),%eax
 
 	popl %esi
 	popl %edi
+
+	LEAVE
 	ret
 END(__mpn_add_n)
diff --git a/sysdeps/i386/i686/memcpy.S b/sysdeps/i386/i686/memcpy.S
index eab6855d57..8e8cc41fbc 100644
--- a/sysdeps/i386/i686/memcpy.S
+++ b/sysdeps/i386/i686/memcpy.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) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -21,20 +21,23 @@
 
 #include <sysdep.h>
 #include "asm-syntax.h"
+#include "bp-asm.h"
 
-/* memcpy:
-	INPUT PARAMETER:
-	dest		(sp + 4)
-	src		(sp + 8)
-	len		(sp + 12)
-*/
+#define PARMS	LINKAGE		/* no space for saved regs */
+#define RTN	PARMS
+#define DEST	RTN+RTN_SIZE
+#define SRC	DEST+PTR_SIZE
+#define LEN	SRC+PTR_SIZE
 
+	.text
 ENTRY(memcpy)
-	movl	12(%esp), %ecx
+	ENTER
+
+	movl	LEN(%esp), %ecx
 	movl	%edi, %eax
-	movl	4(%esp), %edi
+	movl	DEST(%esp), %edi
 	movl	%esi, %edx
-	movl	8(%esp), %esi
+	movl	SRC(%esp), %esi
 	cld
 	shrl	$1, %ecx
 	jnc	1f
@@ -46,6 +49,8 @@ ENTRY(memcpy)
 	movsl
 	movl	%eax, %edi
 	movl	%edx, %esi
-	movl	4(%esp), %eax
-	ret
+	movl	DEST(%esp), %eax
+
+	LEAVE
+	RET_PTR
 END(memcpy)
diff --git a/sysdeps/i386/i686/mempcpy.S b/sysdeps/i386/i686/mempcpy.S
index 4fb14a3d14..c851d06d44 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 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000 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
@@ -21,20 +21,23 @@
 
 #include <sysdep.h>
 #include "asm-syntax.h"
+#include "bp-asm.h"
 
-/* mempcpy:
-	INPUT PARAMETER:
-	dest		(sp + 4)
-	src		(sp + 8)
-	len		(sp + 12)
-*/
+#define PARMS	LINKAGE		/* no space for saved regs */
+#define RTN	PARMS
+#define DEST	RTN+RTN_SIZE
+#define SRC	DEST+PTR_SIZE
+#define LEN	SRC+PTR_SIZE
 
+	.text
 ENTRY(__mempcpy)
-	movl	12(%esp), %ecx
+	ENTER
+
+	movl	LEN(%esp), %ecx
 	movl	%edi, %eax
-	movl	4(%esp), %edi
+	movl	DEST(%esp), %edi
 	movl	%esi, %edx
-	movl	8(%esp), %esi
+	movl	SRC(%esp), %esi
 	cld
 	shrl	$1, %ecx
 	jnc	1f
@@ -46,6 +49,8 @@ ENTRY(__mempcpy)
 	movsl
 	xchgl	%edi, %eax
 	movl	%edx, %esi
-	ret
+
+	LEAVE
+	RET_PTR
 END(__mempcpy)
 weak_alias (__mempcpy, mempcpy)
diff --git a/sysdeps/i386/i686/memset.S b/sysdeps/i386/i686/memset.S
index 83f8c50484..74ce87bfc7 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 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
@@ -21,27 +21,34 @@
 
 #include <sysdep.h>
 #include "asm-syntax.h"
+#include "bp-asm.h"
 
-/*
-   INPUT PARAMETERS:
-   (memset)			(bzero)
-   dst          (sp + 4)	dst	(sp + 4)
-   ch           (sp + 8)	len	(sp + 8)
-   len		(sp + 12)
-*/
+/* BEWARE: `#ifdef memset' means that memset is redefined as `bzero' */
+#define BZERO_P (defined memset)
 
+#define PARMS	LINKAGE+4	/* space for 1 saved reg */
+#if BZERO_P
+# define DEST	PARMS
+# define LEN	DEST+PTR_SIZE
+#else
+# define RTN	PARMS
+# define DEST	RTN+RTN_SIZE
+# define CHR	DEST+PTR_SIZE
+# define LEN	CHR+4
+#endif
 
         .text
 ENTRY (memset)
+	ENTER
+
 	cld
 	pushl	%edi
-	movl	8(%esp), %edx
-#ifdef memset
-	movl	12(%esp), %ecx
-	xorl	%eax, %eax
+	movl	DEST(%esp), %edx
+	movl	LEN(%esp), %ecx
+#if BZERO_P
+	xorl	%eax, %eax	/* fill with 0 */
 #else
-	movzbl	12(%esp), %eax
-	movl	16(%esp), %ecx
+	movzbl	CHR(%esp), %eax
 #endif
 	jecxz	1f
 	movl	%edx, %edi
@@ -61,7 +68,7 @@ ENTRY (memset)
 2:	movl	%ecx, %edx
 	shrl	$2, %ecx
 	andl	$3, %edx
-#ifndef memset
+#if !BZERO_P
 	imul	$0x01010101, %eax
 #endif
 	rep
@@ -71,9 +78,15 @@ ENTRY (memset)
 	stosb
 
 1:
-#ifndef memset
-	movl	8(%esp), %eax
+#if !BZERO_P
+	movl	DEST(%esp), %eax
 #endif
 	popl	%edi
+
+	LEAVE
+#if BZERO_P
 	ret
+#else
+	RET_PTR
+#endif
 END (memset)
diff --git a/sysdeps/i386/i686/strcmp.S b/sysdeps/i386/i686/strcmp.S
index 8ffc5b0bb5..efda8515aa 100644
--- a/sysdeps/i386/i686/strcmp.S
+++ b/sysdeps/i386/i686/strcmp.S
@@ -1,5 +1,5 @@
 /* Highly optimized version for ix86, x>=6.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
@@ -20,29 +20,34 @@
 
 #include <sysdep.h>
 #include "asm-syntax.h"
+#include "bp-asm.h"
 
-/*
-   INPUT PARAMETERS:
-   s1          (sp + 4)
-   s2          (sp + 8)
-*/
-
+#define PARMS	LINKAGE		/* no space for saved regs */
+#define STR1	PARMS
+#define STR2	STR1+PTR_SIZE
 
         .text
 ENTRY (strcmp)
-	movl	4(%esp), %ecx
-	movl	8(%esp), %edx
-1:	movb	(%ecx), %al
+	ENTER
+
+	movl	STR1(%esp), %ecx
+	movl	STR2(%esp), %edx
+
+L(oop):	movb	(%ecx), %al
 	incl	%ecx
 	cmpb	(%edx), %al
-	jne	2f
+	jne	L(neq)
 	incl	%edx
 	testb	%al, %al
-	jnz	1b
+	jnz	L(oop)
+
 	xorl	%eax, %eax
-	jmp	3f
-2:	movl	$1, %eax
-	ja	3f
+	jmp	L(out)
+
+L(neq):	movl	$1, %eax
+	ja	L(out)
 	negl	%eax
-3:	ret
+
+L(out):	LEAVE
+	ret
 END (strcmp)