diff options
author | Roland McGrath <roland@gnu.org> | 2006-02-22 02:39:11 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2006-02-22 02:39:11 +0000 |
commit | 93b94c0412b79a84861f1c2b1d2747d291017d73 (patch) | |
tree | 93e3050dc0b18b8dad27c11b2d4e7eb4673876ac | |
parent | 7d9324612451215ac6402b2d9e73d29b33a0820b (diff) | |
download | glibc-93b94c0412b79a84861f1c2b1d2747d291017d73.tar.gz glibc-93b94c0412b79a84861f1c2b1d2747d291017d73.tar.xz glibc-93b94c0412b79a84861f1c2b1d2747d291017d73.zip |
* sysdeps/i386/i686/memset.S: Fix treatment of unaligned pointer.
Reported by John Zulauf <john.zulauf@amd.com>.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | sysdeps/i386/i686/memset.S | 14 |
2 files changed, 12 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog index f3a99ef2f8..e9562d4846 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-02-21 Roland McGrath <roland@redhat.com> + + * sysdeps/i386/i686/memset.S: Fix treatment of unaligned pointer. + Reported by John Zulauf <john.zulauf@amd.com>. + 2004-11-23 Richard Sandiford <rsandifo@redhat.com> * configure.in (libc_cv_gcc_dwarf2_unwind_info): Delete. diff --git a/sysdeps/i386/i686/memset.S b/sysdeps/i386/i686/memset.S index 5ea50efff8..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, 2005 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. @@ -64,17 +64,17 @@ ENTRY (BP_SYM (memset)) 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 |