about summary refs log tree commit diff
path: root/sysdeps/i386/i686/memset.S
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/memset.S
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/memset.S')
-rw-r--r--sysdeps/i386/i686/memset.S47
1 files changed, 30 insertions, 17 deletions
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)