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
7 * Copyright (C) 2011 MIPS Technologies, Inc.
9 #include <linux/errno.h>
11 #include <asm/asm-offsets.h>
12 #include <asm/export.h>
13 #include <asm/regdef.h>
15 #define EX(insn,reg,addr,handler) \
17 .section __ex_table,"a"; \
22 * Returns: -EFAULT if exception before terminator, N if the entire
23 * buffer filled, else strlen.
27 * Ugly special case have to check: we might get passed a user space
28 * pointer which wraps into the kernel space. We don't deal with that. If
29 * it happens at most some bytes of the exceptions handlers will be copied.
32 LEAF(__strncpy_from_user_asm)
38 1: EX(lbue, v0, (v1), .Lfault)
41 1: EX(lbu, v0, (v1), .Lfault)
50 2: PTR_ADDU v0, a1, t0
55 END(__strncpy_from_user_asm)
61 .section __ex_table,"a"
65 EXPORT_SYMBOL(__strncpy_from_user_asm)