From 3605eae9f2b01f91e6127a9c9107c6065de07a14 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sun, 22 Oct 2006 18:42:12 +0000 Subject: [PATCH] memset must be a real procedure rather then an indirect pointer because GCC-4.x calls it directly. --- sys/platform/pc32/i386/bzero.s | 7 +++++-- sys/platform/pc32/i386/support.s | 6 +----- sys/sys/libkern.h | 20 ++++++-------------- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/sys/platform/pc32/i386/bzero.s b/sys/platform/pc32/i386/bzero.s index 0fab788b6a..fb85051ac4 100644 --- a/sys/platform/pc32/i386/bzero.s +++ b/sys/platform/pc32/i386/bzero.s @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/platform/pc32/i386/bzero.s,v 1.3 2006/09/30 19:25:13 swildner Exp $ + * $DragonFly: src/sys/platform/pc32/i386/bzero.s,v 1.4 2006/10/22 18:42:11 dillon Exp $ */ /* * void bzero(void *buf, u_int len) (arguments passed on stack) @@ -48,7 +48,10 @@ .text -ENTRY(generic_memset) +/* + * GCC-4.x may call memset directly, we can't use an indirect pointer. + */ +ENTRY(memset) pushl %edi movl 4+4(%esp),%edi movl 12+4(%esp),%ecx diff --git a/sys/platform/pc32/i386/support.s b/sys/platform/pc32/i386/support.s index 15dd7c7be8..505049ab73 100644 --- a/sys/platform/pc32/i386/support.s +++ b/sys/platform/pc32/i386/support.s @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/i386/support.s,v 1.67.2.5 2001/08/15 01:23:50 peter Exp $ - * $DragonFly: src/sys/platform/pc32/i386/support.s,v 1.13 2006/09/30 19:25:13 swildner Exp $ + * $DragonFly: src/sys/platform/pc32/i386/support.s,v 1.14 2006/10/22 18:42:11 dillon Exp $ */ #include "use_npx.h" @@ -55,10 +55,6 @@ memcpy_vector: bcopy_vector: .long asm_generic_bcopy - .globl memset -memset: - .long generic_memset - .globl bzero bzero: .long generic_bzero diff --git a/sys/sys/libkern.h b/sys/sys/libkern.h index 16e7113c38..dc18eee591 100644 --- a/sys/sys/libkern.h +++ b/sys/sys/libkern.h @@ -32,7 +32,7 @@ * * @(#)libkern.h 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/sys/libkern.h,v 1.20.2.2 2001/09/30 21:12:54 luigi Exp $ - * $DragonFly: src/sys/sys/libkern.h,v 1.10 2006/09/03 18:52:29 dillon Exp $ + * $DragonFly: src/sys/sys/libkern.h,v 1.11 2006/10/22 18:42:12 dillon Exp $ */ #ifndef _SYS_LIBKERN_H_ @@ -100,6 +100,11 @@ int strncmp (const char *, const char *, size_t); char *strncpy (char * __restrict, const char * __restrict, size_t); int _fnmatch(const char *, const char *, int, int); +/* + * memset can't be an inline, it is used by gcc-4.x directly. + */ +void *memset(void *b, int c, size_t len); + static __inline int fnmatch(const char *pattern, const char *string, int flags) { @@ -112,19 +117,6 @@ memcmp(const void *b1, const void *b2, size_t len) return (bcmp(b1, b2, len)); } -static __inline void * -memset(void *b, int c, size_t len) -{ - char *bb; - - if (c == 0) - bzero(b, len); - else - for (bb = (char *)b; len--; ) - *bb++ = c; - return (b); -} - /* fnmatch() return values. */ #define FNM_NOMATCH 1 /* Match failed. */ -- 2.41.0