2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (c) 1996, 1999 by Ralf Baechle
8 #include <linux/errno.h>
10 #include <asm/asm-offsets.h>
11 #include <asm/regdef.h>
13 #define EX(insn,reg,addr,handler) \
15 .section __ex_table,"a"; \
20 * Returns: -EFAULT if exception before terminator, N if the entire
21 * buffer filled, else strlen.
25 * Ugly special case have to check: we might get passed a user space
26 * pointer which wraps into the kernel space. We don't deal with that. If
27 * it happens at most some bytes of the exceptions handlers will be copied.
30 LEAF(__strncpy_from_user_asm)
31 LONG_L v0, TI_ADDR_LIMIT($28) # pointer ok?
35 FEXPORT(__strncpy_from_user_nocheck_asm)
39 1: EX(lbu, t0, (v1), .Lfault)
48 2: PTR_ADDU t0, a1, v0
52 END(__strncpy_from_user_asm)
54 .Lfault: li v0, -EFAULT
57 .section __ex_table,"a"