8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / sgs / rtld.4.x / zero.s
blobd1efb9413847526b3b204fc044d3a89a7c492101
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright (c) 1990, 1991 Sun Microsystems, Inc.
26 #ident "%Z%%M% %I% %E% SMI"
29 * Routine to zero out a section of memory (the tail end of the data segment
30 * upto a page boundary). First nibble off any bytes up to the first double
31 * aligned word, and then clear doubles until the byte count is zero. Note,
32 * this assumes the count specified has been rounded to end on a double word
33 * boundary.
35 * %o0 = addr, %o1 = len
38 .seg "text"
39 .global __zero
40 __zero:
41 tst %o1 ! Have we any count at all?
42 ba 3f ! Go find out,
43 clr %g1 ! but prepare for long loop
45 ! Byte clearing loop
48 inc %o0 ! Bump address
49 deccc %o1 ! Decrement count
51 bz 1f ! If no count left, exit
52 andcc %o0, 7, %g0 ! Is the address less than double-word aligned?
53 bnz,a 0b ! Branch if so
54 clrb [%o0] ! but clear the current byte anyway
56 ! Double clearing loop
59 std %g0, [%o0] ! Clear next 8 bytes
60 subcc %o1, 8, %o1 ! Decrement count
61 bnz 2b ! Branch if any left
62 inc 8, %o0 ! but always increment address by 8
64 retl ! Go home
65 nop