1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
/* $OpenBSD: bzero.S,v 1.2 1999/05/09 18:49:10 mickey Exp $ */
/*
* (c) Copyright 1988 HEWLETT-PACKARD COMPANY
*
* To anyone who acknowledges that this file is provided "AS IS"
* without any express or implied warranty:
* permission to use, copy, modify, and distribute this file
* for any purpose is hereby granted without fee, provided that
* the above copyright notice and this notice appears in all
* copies, and that the name of Hewlett-Packard Company not be
* used in advertising or publicity pertaining to distribution
* of the software without specific, written prior permission.
* Hewlett-Packard Company makes no representations about the
* suitability of this software for any purpose.
*/
/*
* Copyright (c) 1990,1994 The University of Utah and
* the Computer Systems Laboratory (CSL). All rights reserved.
*
* THE UNIVERSITY OF UTAH AND CSL PROVIDE THIS SOFTWARE IN ITS "AS IS"
* CONDITION, AND DISCLAIM ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
* WHATSOEVER RESULTING FROM ITS USE.
*
* CSL requests users of this software to return to csl-dist@cs.utah.edu any
* improvements that they make and grant CSL redistribution rights.
*
* Utah $Hdr: bzero.s 1.9 94/12/14$
* Author: Bob Wheeler, University of Utah CSL
*/
#include <machine/asm.h>
/*
* void
* blkclr(dst, count)
* void *dst;
* u_int count;
*/
ENTRY(blkclr)
/*
* void
* bzero(dst, count)
* vm_offset_t dst;
* int count;
*/
ALTENTRY(bzero)
comb,>=,n r0,arg1,$bzero_exit
/*
* If we need to clear less than a word do it a byte at a time
*/
comib,>,n 4,arg1,$bzero_bytes
/*
* Since we are only clearing memory the alignment restrictions
* are simplified. Figure out how many "extra" bytes we need to
* store with stbys.
*/
extru arg0,31,2,t2
add arg1,t2,arg1
/*
* We will zero the destination in blocks of 16 bytes as long as we
* can and then we'll go to the 4 byte moves.
*/
addib,<,n -16,arg1,$bzero_word
$bzero_loop_16
stbys,b,m r0,4(arg0)
stwm r0,4(arg0)
stwm r0,4(arg0)
addib,>= -16,arg1,$bzero_loop_16
stwm r0,4(arg0)
/*
* see if there is anything left that needs to be zeroed in a word
* move. Since the count was decremented by 16, add 12 to test if
* there are any full word moves left to do.
*/
$bzero_word
addib,<,n 12,arg1,$bzero_cleanup
$bzero_loop_4
addib,>= -4,arg1,$bzero_loop_4
stbys,b,m r0,4(arg0)
/*
* zero the last bytes that may be unaligned on a word boundary
*/
$bzero_cleanup
addib,=,n 4,arg1,$bzero_exit
add arg0,arg1,arg0
b $bzero_exit
stbys,e r0,0(arg0)
b,n $bzero_exit
/*
* zero by bytes
*/
$bzero_bytes
addib,> -1,arg1,$bzero_bytes
stbs,ma r0,1(arg0)
$bzero_exit
bv 0(rp)
nop
EXIT(bzero)
.end
|