~ubuntu-branches/ubuntu/gutsy/avr-libc/gutsy

« back to all changes in this revision

Viewing changes to libc/string/memmove.S

  • Committer: Bazaar Package Importer
  • Author(s): Hakan Ardo
  • Date: 2006-05-01 12:03:39 UTC
  • mto: (3.1.1 edgy)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20060501120339-q93dxulpunby36dj
Tags: upstream-1.4.4
ImportĀ upstreamĀ versionĀ 1.4.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
27
  POSSIBILITY OF SUCH DAMAGE. */
28
28
 
 
29
/* $Id: memmove.S,v 1.6 2005/10/30 19:36:53 aesok Exp $ */
 
30
 
29
31
#include "macros.inc"
30
32
 
31
33
#define dest_hi r25
44
46
 
45
47
    \returns The memmove() function returns a pointer to dest.  */
46
48
 
47
 
#if !defined(DOXYGEN)
 
49
#if !defined(__DOXYGEN__)
48
50
 
49
51
        .extern _U(memcpy)
50
52
        .text
55
57
; otherwise memcpy will do the right thing
56
58
        cp      src_lo, dest_lo
57
59
        cpc     src_hi, dest_hi
58
 
        brcc    .memmove_fwd
59
 
        LOAD_Z(src_lo, src_hi)
60
 
        LOAD_X(dest_lo, dest_hi)
 
60
        brcc    .L_memmove_fwd
 
61
        X_movw  ZL, src_lo
 
62
        X_movw  XL, dest_lo
61
63
        add     ZL, len_lo
62
64
        adc     ZH, len_hi
63
65
        add     XL, len_lo
64
66
        adc     XH, len_hi
65
 
        rjmp    .memmove_start
66
 
.memmove_loop:
 
67
        rjmp    .L_memmove_start
 
68
.L_memmove_loop:
67
69
        ld      __tmp_reg__, -Z
68
70
        st      -X, __tmp_reg__
69
 
.memmove_start:
 
71
.L_memmove_start:
70
72
        subi    len_lo, lo8(1)
71
73
        sbci    len_hi, hi8(1)
72
 
        brcc    .memmove_loop
 
74
        brcc    .L_memmove_loop
73
75
; return dest (unchanged)
74
76
        ret
75
 
.memmove_fwd:
 
77
.L_memmove_fwd:
76
78
        XJMP    _U(memcpy)
77
 
.memmove_end:
78
 
        .size   _U(memmove), .memmove_end - _U(memmove)
 
79
.L_memmove_end:
 
80
        .size   _U(memmove), .L_memmove_end - _U(memmove)
79
81
 
80
 
#endif /* not DOXYGEN */
 
82
#endif /* not __DOXYGEN__ */