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>
8 #include <asm/export.h>
12 ENTRY(memset) /* %o0=buf, %o1=pat, %o2=len */
23 ENTRY(__bzero) /* %o0=buf, %o1=len */
26 brz,pn %o1, __bzero_done
28 bl,pn %icc, __bzero_tiny
29 prefetch [%o0 + 0x000], #n_writes
32 1: stb %o2, [%o0 + 0x00]
37 2: andcc %o0, 0x7, %g0
47 prefetch [%o0 + 0x040], #n_writes
48 prefetch [%o0 + 0x080], #n_writes
49 prefetch [%o0 + 0x0c0], #n_writes
50 prefetch [%o0 + 0x100], #n_writes
51 prefetch [%o0 + 0x140], #n_writes
52 4: prefetch [%o0 + 0x180], #n_writes
66 5: stx %o2, [%o0 + 0x00]
70 6: brz,pt %o1, __bzero_done
73 1: stb %o2, [%o0 + 0x00]
82 EXPORT_SYMBOL(__bzero)
87 .section __ex_table,"a";\
89 .word 98b, __retl_o1; \
93 ENTRY(__clear_user) /* %o0=buf, %o1=len */
94 brz,pn %o1, __clear_user_done
96 bl,pn %icc, __clear_user_tiny
97 EX_ST(prefetcha [%o0 + 0x00] %asi, #n_writes)
100 1: EX_ST(stba %g0, [%o0 + 0x00] %asi)
105 2: andcc %o0, 0x7, %g0
107 EX_ST(stwa %g0, [%o0 + 0x00] %asi)
110 3: and %o1, 0x38, %g1
115 EX_ST(prefetcha [%o0 + 0x040] %asi, #n_writes)
116 EX_ST(prefetcha [%o0 + 0x080] %asi, #n_writes)
117 EX_ST(prefetcha [%o0 + 0x0c0] %asi, #n_writes)
118 EX_ST(prefetcha [%o0 + 0x100] %asi, #n_writes)
119 EX_ST(prefetcha [%o0 + 0x140] %asi, #n_writes)
120 4: EX_ST(prefetcha [%o0 + 0x180] %asi, #n_writes)
121 EX_ST(stxa %g0, [%o0 + 0x00] %asi)
122 EX_ST(stxa %g0, [%o0 + 0x08] %asi)
123 EX_ST(stxa %g0, [%o0 + 0x10] %asi)
124 EX_ST(stxa %g0, [%o0 + 0x18] %asi)
125 EX_ST(stxa %g0, [%o0 + 0x20] %asi)
126 EX_ST(stxa %g0, [%o0 + 0x28] %asi)
127 EX_ST(stxa %g0, [%o0 + 0x30] %asi)
128 EX_ST(stxa %g0, [%o0 + 0x38] %asi)
134 5: EX_ST(stxa %g0, [%o0 + 0x00] %asi)
138 6: brz,pt %o1, __clear_user_done
141 1: EX_ST(stba %g0, [%o0 + 0x00] %asi)
148 ENDPROC(__clear_user)
149 EXPORT_SYMBOL(__clear_user)