[BACK]Return to index.S CVS log [TXT][DIR] Up to [local] / sys / lib / libkern / arch / amd64

Annotation of sys/lib/libkern/arch/amd64/index.S, Revision 1.1.1.1

1.1       nbrk        1: /*
                      2:  * Written by J.T. Conklin <jtc@netbsd.org>.
                      3:  * Public domain.
                      4:  * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com>
                      5:  */
                      6:
                      7: #include <machine/asm.h>
                      8:
                      9: #if defined(LIBC_SCCS)
                     10:        RCSID("$NetBSD: index.S,v 1.1 2001/06/19 00:22:46 fvdl Exp $")
                     11: #endif
                     12:
                     13: #ifdef STRCHR
                     14: ENTRY(strchr)
                     15: #else
                     16: ENTRY(index)
                     17: #endif
                     18:        movq    %rdi,%rax
                     19:        movb    %sil,%cl
                     20: L1:
                     21:        movb    (%rax),%dl
                     22:        cmpb    %dl,%cl                 /* found char? */
                     23:        je      L2
                     24:        incq    %rax
                     25:        testb   %dl,%dl                 /* null terminator? */
                     26:        jnz     L1
                     27:        xorq    %rax,%rax
                     28: L2:
                     29:        ret

CVSweb