~xnox/ubuntu/trusty/gcc-arm-linux-androideabi/dima

« back to all changes in this revision

Viewing changes to android/bionic/libc/arch-x86/string/bzero.S

  • Committer: Package Import Robot
  • Author(s): Dmitrijs Ledkovs
  • Date: 2013-07-05 10:12:24 UTC
  • Revision ID: package-import@ubuntu.com-20130705101224-6qo3e8jbz8p31aa1
Tags: upstream-0.20130705.1
ImportĀ upstreamĀ versionĀ 0.20130705.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*      $OpenBSD: bzero.S,v 1.3 2005/08/07 11:30:38 espie Exp $ */
 
2
/*
 
3
 * Written by J.T. Conklin <jtc@netbsd.org>.
 
4
 * Public domain.
 
5
 */
 
6
 
 
7
#include <machine/asm.h>
 
8
 
 
9
ENTRY(bzero)
 
10
        pushl   %edi
 
11
        movl    8(%esp),%edi
 
12
        movl    12(%esp),%edx
 
13
 
 
14
        cld                             /* set fill direction forward */
 
15
        xorl    %eax,%eax               /* set fill data to 0 */
 
16
 
 
17
        /*
 
18
         * if the string is too short, it's really not worth the overhead
 
19
         * of aligning to word boundries, etc.  So we jump to a plain
 
20
         * unaligned set.
 
21
         */
 
22
        cmpl    $16,%edx
 
23
        jb      L1
 
24
 
 
25
        movl    %edi,%ecx               /* compute misalignment */
 
26
        negl    %ecx
 
27
        andl    $3,%ecx
 
28
        subl    %ecx,%edx
 
29
        rep                             /* zero until word aligned */
 
30
        stosb
 
31
 
 
32
        movl    %edx,%ecx               /* zero by words */
 
33
        shrl    $2,%ecx
 
34
        andl    $3,%edx
 
35
        rep
 
36
        stosl
 
37
 
 
38
L1:     movl    %edx,%ecx               /* zero remainder by bytes */
 
39
        rep
 
40
        stosb
 
41
 
 
42
        popl    %edi
 
43
        ret