OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libc/] [machine/] [i386/] [memmove.S] - Diff between revs 1008 and 1765

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 1008 Rev 1765
/*
/*
 * ====================================================
 * ====================================================
 * Copyright (C) 1998 by Cygnus Solutions. All rights reserved.
 * Copyright (C) 1998 by Cygnus Solutions. All rights reserved.
 *
 *
 * Permission to use, copy, modify, and distribute this
 * Permission to use, copy, modify, and distribute this
 * software is freely granted, provided that this notice
 * software is freely granted, provided that this notice
 * is preserved.
 * is preserved.
 * ====================================================
 * ====================================================
 */
 */
        #include "i386mach.h"
        #include "i386mach.h"
        .global SYM (memmove)
        .global SYM (memmove)
       SOTYPE_FUNCTION(memmove)
       SOTYPE_FUNCTION(memmove)
SYM (memmove):
SYM (memmove):
        pushl ebp
        pushl ebp
        movl esp,ebp
        movl esp,ebp
        pushl esi
        pushl esi
        pushl edi
        pushl edi
        pushl ebx
        pushl ebx
        movl 8(ebp),edi
        movl 8(ebp),edi
        movl 16(ebp),ecx
        movl 16(ebp),ecx
        movl 12(ebp),esi
        movl 12(ebp),esi
/*  check for destructive overlap (src < dst && dst < src + length) */
/*  check for destructive overlap (src < dst && dst < src + length) */
        cld
        cld
        cmpl edi,esi
        cmpl edi,esi
        jae  .L2
        jae  .L2
        leal -1(ecx,esi),ebx
        leal -1(ecx,esi),ebx
        cmpl ebx,edi
        cmpl ebx,edi
        ja   .L2
        ja   .L2
/* IF:   destructive overlap, must copy backwards */
/* IF:   destructive overlap, must copy backwards */
        addl ecx,esi
        addl ecx,esi
        addl ecx,edi
        addl ecx,edi
        std
        std
#ifndef __OPTIMIZE_SIZE__
#ifndef __OPTIMIZE_SIZE__
        cmpl $8,ecx
        cmpl $8,ecx
        jbe .L13
        jbe .L13
.L18:
.L18:
/* move trailing bytes in reverse until destination address is long word aligned */
/* move trailing bytes in reverse until destination address is long word aligned */
        movl edi,edx
        movl edi,edx
        movl ecx,ebx
        movl ecx,ebx
        andl $3,edx
        andl $3,edx
        jz .L21
        jz .L21
        movl edx,ecx
        movl edx,ecx
        decl esi
        decl esi
        decl edi
        decl edi
        subl ecx,ebx
        subl ecx,ebx
        rep
        rep
        movsb
        movsb
        mov ebx,ecx
        mov ebx,ecx
        incl esi
        incl esi
        incl edi
        incl edi
.L21:
.L21:
/* move bytes in reverse, a long word at a time */
/* move bytes in reverse, a long word at a time */
        shrl $2,ecx
        shrl $2,ecx
        subl $4,esi
        subl $4,esi
        subl $4,edi
        subl $4,edi
        rep
        rep
        movsl
        movsl
        addl $4,esi
        addl $4,esi
        addl $4,edi
        addl $4,edi
        movl ebx,ecx
        movl ebx,ecx
        andl $3,ecx
        andl $3,ecx
#endif /* !__OPTIMIZE_SIZE__ */
#endif /* !__OPTIMIZE_SIZE__ */
/* handle any remaining bytes not on a long word boundary */
/* handle any remaining bytes not on a long word boundary */
.L13:
.L13:
        decl esi
        decl esi
        decl edi
        decl edi
.L15:
.L15:
        rep
        rep
        movsb
        movsb
        jmp .L5
        jmp .L5
        .p2align 4,,7
        .p2align 4,,7
/* ELSE:   no destructive overlap so we copy forwards */
/* ELSE:   no destructive overlap so we copy forwards */
.L2:
.L2:
#ifndef __OPTIMIZE_SIZE__
#ifndef __OPTIMIZE_SIZE__
        cmpl $8,ecx
        cmpl $8,ecx
        jbe .L3
        jbe .L3
/* move any preceding bytes until destination address is long word aligned */
/* move any preceding bytes until destination address is long word aligned */
        movl edi,edx
        movl edi,edx
        movl ecx,ebx
        movl ecx,ebx
        andl $3,edx
        andl $3,edx
        jz .L11
        jz .L11
        movl $4,ecx
        movl $4,ecx
        subl edx,ecx
        subl edx,ecx
        andl $3,ecx
        andl $3,ecx
        subl ecx,ebx
        subl ecx,ebx
        rep
        rep
        movsb
        movsb
        mov ebx,ecx
        mov ebx,ecx
/* move bytes a long word at a time */
/* move bytes a long word at a time */
.L11:
.L11:
        shrl $2,ecx
        shrl $2,ecx
        .p2align 2
        .p2align 2
        rep
        rep
        movsl
        movsl
        movl ebx,ecx
        movl ebx,ecx
        andl $3,ecx
        andl $3,ecx
#endif /* !__OPTIMIZE_SIZE__ */
#endif /* !__OPTIMIZE_SIZE__ */
/* handle any remaining bytes */
/* handle any remaining bytes */
.L3:
.L3:
        rep
        rep
        movsb
        movsb
.L5:
.L5:
        movl 8(ebp),eax
        movl 8(ebp),eax
        cld
        cld
        leal -12(ebp),esp
        leal -12(ebp),esp
        popl ebx
        popl ebx
        popl edi
        popl edi
        popl esi
        popl esi
        leave
        leave
        ret
        ret
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.