1 /* bzero.S: Simple prefetching memset, bzero, and clear_user
4 * Copyright (C) 2005 David S. Miller <davem@davemloft.net>
7 #include <linux/linkage.h>
11 ENTRY(memset) /* %o0=buf, %o1=pat, %o2=len */
22 ENTRY(__bzero) /* %o0=buf, %o1=len */
25 brz,pn %o1, __bzero_done
27 bl,pn %icc, __bzero_tiny
28 prefetch [%o0 + 0x000], #n_writes
31 1: stb %o2, [%o0 + 0x00]
36 2: andcc %o0, 0x7, %g0
46 prefetch [%o0 + 0x040], #n_writes
47 prefetch [%o0 + 0x080], #n_writes
48 prefetch [%o0 + 0x0c0], #n_writes
49 prefetch [%o0 + 0x100], #n_writes
50 prefetch [%o0 + 0x140], #n_writes
51 4: prefetch [%o0 + 0x180], #n_writes
65 5: stx %o2, [%o0 + 0x00]
69 6: brz,pt %o1, __bzero_done
72 1: stb %o2, [%o0 + 0x00]
84 .section __ex_table,"a";\
86 .word 98b, __retl_o1; \
90 ENTRY(__clear_user) /* %o0=buf, %o1=len */
91 brz,pn %o1, __clear_user_done
93 bl,pn %icc, __clear_user_tiny
94 EX_ST(prefetcha [%o0 + 0x00] %asi, #n_writes)
97 1: EX_ST(stba %g0, [%o0 + 0x00] %asi)
102 2: andcc %o0, 0x7, %g0
104 EX_ST(stwa %g0, [%o0 + 0x00] %asi)
107 3: and %o1, 0x38, %g1
112 EX_ST(prefetcha [%o0 + 0x040] %asi, #n_writes)
113 EX_ST(prefetcha [%o0 + 0x080] %asi, #n_writes)
114 EX_ST(prefetcha [%o0 + 0x0c0] %asi, #n_writes)
115 EX_ST(prefetcha [%o0 + 0x100] %asi, #n_writes)
116 EX_ST(prefetcha [%o0 + 0x140] %asi, #n_writes)
117 4: EX_ST(prefetcha [%o0 + 0x180] %asi, #n_writes)
118 EX_ST(stxa %g0, [%o0 + 0x00] %asi)
119 EX_ST(stxa %g0, [%o0 + 0x08] %asi)
120 EX_ST(stxa %g0, [%o0 + 0x10] %asi)
121 EX_ST(stxa %g0, [%o0 + 0x18] %asi)
122 EX_ST(stxa %g0, [%o0 + 0x20] %asi)
123 EX_ST(stxa %g0, [%o0 + 0x28] %asi)
124 EX_ST(stxa %g0, [%o0 + 0x30] %asi)
125 EX_ST(stxa %g0, [%o0 + 0x38] %asi)
131 5: EX_ST(stxa %g0, [%o0 + 0x00] %asi)
135 6: brz,pt %o1, __clear_user_done
138 1: EX_ST(stba %g0, [%o0 + 0x00] %asi)
145 ENDPROC(__clear_user)