xref: /netbsd-src/common/lib/libc/arch/i386/string/small/memset.S (revision 2c56941e163201dcb781df7fdeec6bd093647c91)
1*2c56941eSjakllsch/*	$NetBSD: memset.S,v 1.2 2014/03/22 19:38:46 jakllsch Exp $	*/
2bdaa91a3Sjoerg
3bdaa91a3Sjoerg/*-
4bdaa91a3Sjoerg * Copyright (c) 2011 The NetBSD Foundation, Inc.
5bdaa91a3Sjoerg * All rights reserved.
6bdaa91a3Sjoerg *
7bdaa91a3Sjoerg * This code is derived from software contributed to The NetBSD Foundation
8bdaa91a3Sjoerg * by Joerg Sonnenberger.
9bdaa91a3Sjoerg *
10bdaa91a3Sjoerg * Redistribution and use in source and binary forms, with or without
11bdaa91a3Sjoerg * modification, are permitted provided that the following conditions
12bdaa91a3Sjoerg * are met:
13bdaa91a3Sjoerg * 1. Redistributions of source code must retain the above copyright
14bdaa91a3Sjoerg *    notice, this list of conditions and the following disclaimer.
15bdaa91a3Sjoerg * 2. Redistributions in binary form must reproduce the above copyright
16bdaa91a3Sjoerg *    notice, this list of conditions and the following disclaimer in the
17bdaa91a3Sjoerg *    documentation and/or other materials provided with the distribution.
18bdaa91a3Sjoerg *
19bdaa91a3Sjoerg * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20bdaa91a3Sjoerg * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21bdaa91a3Sjoerg * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22bdaa91a3Sjoerg * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23bdaa91a3Sjoerg * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24bdaa91a3Sjoerg * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25bdaa91a3Sjoerg * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26bdaa91a3Sjoerg * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27bdaa91a3Sjoerg * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28bdaa91a3Sjoerg * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29bdaa91a3Sjoerg * POSSIBILITY OF SUCH DAMAGE.
30bdaa91a3Sjoerg */
31bdaa91a3Sjoerg
32bdaa91a3Sjoerg#include <machine/asm.h>
33*2c56941eSjakllsch	RCSID("$NetBSD: memset.S,v 1.2 2014/03/22 19:38:46 jakllsch Exp $")
34bdaa91a3Sjoerg
35bdaa91a3SjoergENTRY(memset)
36bdaa91a3Sjoerg	pushl	%edi
37bdaa91a3Sjoerg	movl	8(%esp), %edi
38bdaa91a3Sjoerg	movl	12(%esp), %eax
39bdaa91a3Sjoerg	movl	16(%esp), %ecx
40bdaa91a3Sjoerg	pushl	%edi
41bdaa91a3Sjoerg	rep
42bdaa91a3Sjoerg	stosb
43bdaa91a3Sjoerg	popl	%eax
44bdaa91a3Sjoerg	popl	%edi
45bdaa91a3Sjoerg	ret
46*2c56941eSjakllschEND(memset)
47