2 * Written by J.T. Conklin <jtc@NetBSD.org>.
4 * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com>
6 * $NetBSD: memset.S,v 1.3 2004/02/26 20:50:06 drochner Exp $
7 * $FreeBSD: src/lib/libc/amd64/string/memset.S,v 1.2 2008/11/02 01:10:54 peter Exp $
10 #include <machine/asm.h>
18 cld /* set fill direction forward */
21 * if the string is too short, it's really not worth the overhead
22 * of aligning to word boundries, etc. So we jump to a plain
28 movb %al,%ah /* copy char to all bytes in word */
37 movq %rdi,%rdx /* compute misalignment */
43 movq %rdx,%rcx /* set until word aligned */
48 shrq $3,%rcx /* set by words */
52 movq %r8,%rcx /* set remainder by bytes */