1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
6 #include <linux/export.h>
7 #include <asm/alternative-asm.h>
9 #include <asm/asmmacro.h>
10 #include <asm/asm-extable.h>
12 #include <asm/regdef.h>
13 #include <asm/unwind_hints.h>
15 SYM_FUNC_START(__copy_user)
17 * Some CPUs support hardware unaligned access
19 ALTERNATIVE "b __copy_user_generic", \
20 "b __copy_user_fast", CPU_FEATURE_UAL
21 SYM_FUNC_END(__copy_user)
23 EXPORT_SYMBOL(__copy_user)
26 * unsigned long __copy_user_generic(void *to, const void *from, size_t n)
32 SYM_FUNC_START(__copy_user_generic)
47 SYM_FUNC_END(__copy_user_generic)
50 * unsigned long __copy_user_fast(void *to, const void *from, unsigned long n)
56 SYM_FUNC_START(__copy_user_fast)
65 /* align up destination address */
75 /* copy 64 bytes at a time */
97 /* copy the remaining bytes */
205 /* fixup and ex_table */
221 _asm_extable 0b, .Lsmall_fixup
222 _asm_extable 1b, .Lsmall_fixup
223 _asm_extable 2b, .Llarge_fixup
224 _asm_extable 3b, .Llarge_fixup
225 _asm_extable 4b, .Llarge_fixup
226 _asm_extable 5b, .Llarge_fixup
227 _asm_extable 6b, .Llarge_fixup
228 _asm_extable 7b, .Llarge_fixup
229 _asm_extable 8b, .Llarge_fixup
230 _asm_extable 9b, .Llarge_fixup
231 _asm_extable 10b, .Llarge_fixup
232 _asm_extable 11b, .Llarge_fixup
233 _asm_extable 12b, .Llarge_fixup
234 _asm_extable 13b, .Llarge_fixup
235 _asm_extable 14b, .Llarge_fixup
236 _asm_extable 15b, .Llarge_fixup
237 _asm_extable 16b, .Llarge_fixup
238 _asm_extable 17b, .Llarge_fixup
239 _asm_extable 18b, .Llarge_fixup
240 _asm_extable 19b, .Llarge_fixup
241 _asm_extable 20b, .Llarge_fixup
242 _asm_extable 21b, .Llarge_fixup
243 _asm_extable 22b, .Llarge_fixup
244 _asm_extable 23b, .Llarge_fixup
245 _asm_extable 24b, .Llarge_fixup
246 _asm_extable 25b, .Llarge_fixup
247 _asm_extable 26b, .Llarge_fixup
248 _asm_extable 27b, .Llarge_fixup
249 _asm_extable 28b, .Llarge_fixup
250 _asm_extable 29b, .Llarge_fixup
251 _asm_extable 30b, .Llarge_fixup
252 _asm_extable 31b, .Llarge_fixup
253 _asm_extable 32b, .Llarge_fixup
254 _asm_extable 33b, .Llarge_fixup
255 _asm_extable 34b, .Lexit
256 _asm_extable 35b, .Lexit
257 _asm_extable 36b, .Lsmall_fixup
258 _asm_extable 37b, .Lsmall_fixup
259 _asm_extable 38b, .Lsmall_fixup
260 _asm_extable 39b, .Lsmall_fixup
261 _asm_extable 40b, .Lsmall_fixup
262 _asm_extable 41b, .Lsmall_fixup
263 _asm_extable 42b, .Lsmall_fixup
264 _asm_extable 43b, .Lsmall_fixup
265 _asm_extable 44b, .Lsmall_fixup
266 _asm_extable 45b, .Lsmall_fixup
267 _asm_extable 46b, .Lsmall_fixup
268 _asm_extable 47b, .Lsmall_fixup
269 _asm_extable 48b, .Lsmall_fixup
270 _asm_extable 49b, .Lsmall_fixup
271 _asm_extable 50b, .Lsmall_fixup
272 _asm_extable 51b, .Lsmall_fixup
273 _asm_extable 52b, .Lsmall_fixup
274 _asm_extable 53b, .Lsmall_fixup
275 _asm_extable 54b, .Lsmall_fixup
276 _asm_extable 55b, .Lsmall_fixup
277 _asm_extable 56b, .Lsmall_fixup
278 _asm_extable 57b, .Lsmall_fixup
279 _asm_extable 58b, .Lexit
280 _asm_extable 59b, .Lexit
281 SYM_FUNC_END(__copy_user_fast)
283 STACK_FRAME_NON_STANDARD __copy_user_fast