Go to the documentation of this file.
9 #include <linux/prefetch.h>
10 #include <linux/string.h>
12 #include <asm/uaccess.h>
39 #ifdef CONFIG_ISA_DUAL_ISSUE
41 #define __do_strncpy_from_user(dst,src,count,res) \
43 int __d0, __d1, __d2; \
44 __asm__ __volatile__( \
47 "0: ldb r14, @%3 || addi %3, #1\n" \
48 " stb r14, @%4 || addi %4, #1\n" \
56 ".section .fixup,\"ax\"\n" \
58 "3: seth r14, #high(2b)\n" \
59 " or3 r14, r14, #low(2b)\n" \
60 " jmp r14 || ldi %0, #%5\n" \
62 ".section __ex_table,\"a\"\n" \
66 : "=&r"(res), "=&r"(count), "=&r" (__d0), "=&r" (__d1), \
68 : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \
70 : "r14", "cbit", "memory"); \
75 #define __do_strncpy_from_user(dst,src,count,res) \
77 int __d0, __d1, __d2; \
78 __asm__ __volatile__( \
92 ".section .fixup,\"ax\"\n" \
95 " seth r14, #high(2b)\n" \
96 " or3 r14, r14, #low(2b)\n" \
99 ".section __ex_table,\"a\"\n" \
103 : "=&r"(res), "=&r"(count), "=&r" (__d0), "=&r" (__d1), \
105 : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \
107 : "r14", "cbit", "memory"); \
134 #ifdef CONFIG_ISA_DUAL_ISSUE
136 #define __do_clear_user(addr,size) \
139 __asm__ __volatile__( \
141 " and3 r14, %0, #3\n" \
143 " and3 r14, %1, #3\n" \
145 " and3 %1, %1, #3\n" \
149 "0: ; word clear \n" \
150 " st %6, @+%0 || addi %2, #-1\n" \
154 "2: ; byte clear \n" \
155 " stb %6, @%0 || addi %1, #-1\n" \
160 ".section .fixup,\"ax\"\n" \
163 " seth r14, #high(9b)\n" \
164 " or3 r14, r14, #low(9b)\n" \
165 " jmp r14 || add %1, %2\n" \
167 ".section __ex_table,\"a\"\n" \
172 : "=&r"(__dst), "=&r"(size), "=&r"(__c) \
173 : "0"(addr), "1"(size), "2"(size / 4), "r"(0) \
174 : "r14", "cbit", "memory"); \
179 #define __do_clear_user(addr,size) \
182 __asm__ __volatile__( \
184 " and3 r14, %0, #3\n" \
186 " and3 r14, %1, #3\n" \
188 " and3 %1, %1, #3\n" \
192 "0: st %6, @+%0 ; word clear \n" \
197 "2: stb %6, @%0 ; byte clear \n" \
203 ".section .fixup,\"ax\"\n" \
207 " seth r14, #high(9b)\n" \
208 " or3 r14, r14, #low(9b)\n" \
211 ".section __ex_table,\"a\"\n" \
216 : "=&r"(__dst), "=&r"(size), "=&r"(__c) \
217 : "0"(addr), "1"(size), "2"(size / 4), "r"(0) \
218 : "r14", "cbit", "memory"); \
244 #ifdef CONFIG_ISA_DUAL_ISSUE
252 " and %0, %5 || mv r1, %1\n"
253 " beqz %0, strnlen_exit\n"
255 " bnez r0, strnlen_byte_loop\n"
257 " bc strnlen_byte_loop\n"
258 "strnlen_word_loop:\n"
261 " bc strnlen_last_bytes_fixup\n"
263 " beqz %0, strnlen_exit\n"
264 " bgtz %0, strnlen_word_loop\n"
265 "strnlen_last_bytes:\n"
267 "strnlen_last_bytes_fixup:\n"
269 "strnlen_byte_loop:\n"
270 "1: ldb r0, @%1 || addi %0, #-1\n"
271 " beqz r0, strnlen_exit\n"
273 " bnez %0, strnlen_byte_loop\n"
279 ".section .fixup,\"ax\"\n"
283 "5: seth r1, #high(9b)\n"
284 " or3 r1, r1, #low(9b)\n"
285 " jmp r1 || ldi %0, #0\n"
287 ".section __ex_table,\"a\"\n"
292 :
"=&r" (res),
"=r" (s)
293 :
"0" (n),
"1" (s),
"r" (n & 3),
"r" (mask),
"r"(0x01010101)
294 :
"r0",
"r1",
"cbit");
323 " beqz %0, strnlen_exit\n"
325 " bnez r0, strnlen_byte_loop\n"
327 " bc strnlen_byte_loop\n"
329 "strnlen_word_loop:\n"
335 " bnez r2, strnlen_last_bytes_fixup\n"
337 " beqz %0, strnlen_exit\n"
338 " bgtz %0, strnlen_word_loop\n"
339 "strnlen_last_bytes:\n"
341 "strnlen_last_bytes_fixup:\n"
343 "strnlen_byte_loop:\n"
346 " beqz r0, strnlen_exit\n"
348 " bnez %0, strnlen_byte_loop\n"
354 ".section .fixup,\"ax\"\n"
359 " seth r1, #high(9b)\n"
360 " or3 r1, r1, #low(9b)\n"
363 ".section __ex_table,\"a\"\n"
368 :
"=&r" (res),
"=r" (s)
369 :
"0" (n),
"1" (s),
"r" (n & 3),
"r" (mask),
"r"(0x01010101)
370 :
"r0",
"r1",
"r2",
"r3",
"cbit");