11.2Smatt/*	$NetBSD: memset.S,v 1.2 2011/01/25 04:45:28 matt Exp $	*/
21.1Suwe/*-
31.1Suwe * Copyright (c) 1990, 1993
41.1Suwe *	The Regents of the University of California.  All rights reserved.
51.1Suwe *
61.1Suwe * Redistribution and use in source and binary forms, with or without
71.1Suwe * modification, are permitted provided that the following conditions
81.1Suwe * are met:
91.1Suwe * 1. Redistributions of source code must retain the above copyright
101.1Suwe *    notice, this list of conditions and the following disclaimer.
111.1Suwe * 2. Redistributions in binary form must reproduce the above copyright
121.1Suwe *    notice, this list of conditions and the following disclaimer in the
131.1Suwe *    documentation and/or other materials provided with the distribution.
141.1Suwe * 3. Neither the name of the University nor the names of its contributors
151.1Suwe *    may be used to endorse or promote products derived from this software
161.1Suwe *    without specific prior written permission.
171.1Suwe *
181.1Suwe * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
191.1Suwe * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
201.1Suwe * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
211.1Suwe * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
221.1Suwe * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
231.1Suwe * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
241.1Suwe * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
251.1Suwe * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
261.1Suwe * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
271.1Suwe * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
281.1Suwe * SUCH DAMAGE.
291.1Suwe */
301.1Suwe
311.2Smatt#include <machine/asm.h>
321.2Smatt
331.2Smatt/* .asciz "@(#)memset.s	8.1 (Berkeley) 6/4/93" */
341.2SmattRCSID("$NetBSD: memset.S,v 1.2 2011/01/25 04:45:28 matt Exp $")
351.1Suwe
361.1Suwe/* void *memset(base, c, length) */
371.1Suwe
381.1SuweENTRY(memset, 0)
391.1Suwe	movl	4(%ap),%r3
401.1Suwe1:
411.1Suwe	movzwl	$65535,%r0
421.1Suwe	movq	8(%ap),%r1
431.1Suwe	cmpl	%r2,%r0
441.1Suwe	jgtru	2f
451.1Suwe	movc5	$0,(%r3),%r1,%r2,(%r3)
461.1Suwe	movl	%r1,%r0
471.1Suwe	ret
481.1Suwe2:
491.1Suwe	subl2	%r0,12(%ap)
501.1Suwe	movc5	$0,(%r3),%r1,%r0,(%r3)
511.1Suwe	jbr	1b
521.2SmattEND(memset)
53