]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - sysdeps/m68k/rawmemchr.S
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / sysdeps / m68k / rawmemchr.S
index acd8f76e444b7f621368c44fcb153eb15461e3a2..912f347a20c7ba9118b210cf5855b6f30b5856e0 100644 (file)
@@ -1,6 +1,6 @@
 /* rawmemchr (str, ch) -- Return pointer to first occurrence of CH in STR.
    For Motorola 68000.
-   Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1999-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Schwab <schwab@gnu.org>.
 
@@ -15,9 +15,8 @@
    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.  */
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
 
 #include <sysdep.h>
 #include "asm-syntax.h"
 ENTRY(__rawmemchr)
        /* Save the callee-saved registers we use.  */
        movel   R(d2),MEM_PREDEC(sp)
+       cfi_adjust_cfa_offset (4)
        movel   R(d3),MEM_PREDEC(sp)
+       cfi_adjust_cfa_offset (4)
+       cfi_rel_offset (R(d2), 4)
+       cfi_rel_offset (R(d3), 0)
 
        /* Get string pointer and character.  */
        movel   MEM_DISP(sp,12),R(a0)
@@ -43,21 +46,31 @@ ENTRY(__rawmemchr)
        /* First search for the character one byte at a time until the
           pointer is aligned to a longword boundary.  */
        movel   R(a0),R(d1)
+#ifdef __mcoldfire__
+       andl    #3,R(d1)
+#else
        andw    #3,R(d1)
+#endif
        beq     L(L1)
        cmpb    MEM(a0),R(d0)
        beq     L(L9)
        addql   #1,R(a0)
 
-       movel   R(a0),R(d1)
-       andw    #3,R(d1)
+#ifdef __mcoldfire__
+       subql   #3,R(d1)
+#else
+       subqw   #3,R(d1)
+#endif
        beq     L(L1)
        cmpb    MEM(a0),R(d0)
        beq     L(L9)
        addql   #1,R(a0)
 
-       movel   R(a0),R(d1)
-       andw    #3,R(d1)
+#ifdef __mcoldfire__
+       addql   #1,R(d1)
+#else
+       addqw   #1,R(d1)
+#endif
        beq     L(L1)
        cmpb    MEM(a0),R(d0)
        beq     L(L9)
@@ -172,7 +185,11 @@ L(L8:)
 L(L9:)
        movel   R(a0),R(d0)
        movel   MEM_POSTINC(sp),R(d3)
+       cfi_adjust_cfa_offset (-4)
+       cfi_restore (R(d3))
        movel   MEM_POSTINC(sp),R(d2)
+       cfi_adjust_cfa_offset (-4)
+       cfi_restore (R(d2))
        rts
 END(__rawmemchr)