1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* bzero.S: Simple prefetching memset, bzero, and clear_user
5 * Copyright (C) 2005 David S. Miller <davem@davemloft.net>
8 #include <linux/linkage.h>
9 #include <asm/export.h>
13 ENTRY(memset) /* %o0=buf, %o1=pat, %o2=len */
24 ENTRY(__bzero) /* %o0=buf, %o1=len */
27 brz,pn %o1, __bzero_done
29 bl,pn %icc, __bzero_tiny
30 prefetch [%o0 + 0x000], #n_writes
33 1: stb %o2, [%o0 + 0x00]
38 2: andcc %o0, 0x7, %g0
48 prefetch [%o0 + 0x040], #n_writes
49 prefetch [%o0 + 0x080], #n_writes
50 prefetch [%o0 + 0x0c0], #n_writes
51 prefetch [%o0 + 0x100], #n_writes
52 prefetch [%o0 + 0x140], #n_writes
53 4: prefetch [%o0 + 0x180], #n_writes
67 5: stx %o2, [%o0 + 0x00]
71 6: brz,pt %o1, __bzero_done
74 1: stb %o2, [%o0 + 0x00]
83 EXPORT_SYMBOL(__bzero)
88 .section __ex_table,"a";\
90 .word 98b, __retl_o1; \
94 ENTRY(__clear_user) /* %o0=buf, %o1=len */
95 brz,pn %o1, __clear_user_done
97 bl,pn %icc, __clear_user_tiny
98 EX_ST(prefetcha [%o0 + 0x00] %asi, #n_writes)
101 1: EX_ST(stba %g0, [%o0 + 0x00] %asi)
106 2: andcc %o0, 0x7, %g0
108 EX_ST(stwa %g0, [%o0 + 0x00] %asi)
111 3: and %o1, 0x38, %g1
116 EX_ST(prefetcha [%o0 + 0x040] %asi, #n_writes)
117 EX_ST(prefetcha [%o0 + 0x080] %asi, #n_writes)
118 EX_ST(prefetcha [%o0 + 0x0c0] %asi, #n_writes)
119 EX_ST(prefetcha [%o0 + 0x100] %asi, #n_writes)
120 EX_ST(prefetcha [%o0 + 0x140] %asi, #n_writes)
121 4: EX_ST(prefetcha [%o0 + 0x180] %asi, #n_writes)
122 EX_ST(stxa %g0, [%o0 + 0x00] %asi)
123 EX_ST(stxa %g0, [%o0 + 0x08] %asi)
124 EX_ST(stxa %g0, [%o0 + 0x10] %asi)
125 EX_ST(stxa %g0, [%o0 + 0x18] %asi)
126 EX_ST(stxa %g0, [%o0 + 0x20] %asi)
127 EX_ST(stxa %g0, [%o0 + 0x28] %asi)
128 EX_ST(stxa %g0, [%o0 + 0x30] %asi)
129 EX_ST(stxa %g0, [%o0 + 0x38] %asi)
135 5: EX_ST(stxa %g0, [%o0 + 0x00] %asi)
139 6: brz,pt %o1, __clear_user_done
142 1: EX_ST(stba %g0, [%o0 + 0x00] %asi)
149 ENDPROC(__clear_user)
150 EXPORT_SYMBOL(__clear_user)