2 * Copyright (C) 2009 Michal Simek <monstr@monstr.eu>
3 * Copyright (C) 2009 PetaLogix
4 * Copyright (C) 2007 LynuxWorks, Inc.
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
11 #include <linux/errno.h>
12 #include <linux/linkage.h>
15 * int __strncpy_user(char *to, char *from, int len);
18 * -EFAULT for an exception
19 * len if we hit the buffer limit
24 .globl __strncpy_user;
35 addik r3,r7,0 /* temp_count = len */
42 beqi r3,2f /* break on len */
46 addik r6,r6,1 /* delay slot */
47 addik r3,r3,1 /* undo "temp_count--" */
49 rsubk r3,r3,r7 /* temp_count = len - temp_count */
61 .section __ex_table, "a"
65 * int __strnlen_user(char __user *str, int maxlen);
69 * maxlen + 1 if no NUL byte found within maxlen bytes
70 * size of the string (including NUL byte)
74 .globl __strnlen_user;
81 beqid r4,2f /* break on NUL */
82 addik r3,r3,-1 /* delay slot */
85 addik r5,r5,1 /* delay slot */
87 addik r3,r3,-1 /* for break on len */
100 .section __ex_table,"a"
104 * int __copy_tofrom_user(char *to, char *from, int len)
107 * number of not copied bytes on error
110 .globl __copy_tofrom_user;
128 addik r5,r5,1 /* delay slot */
134 .section __ex_table,"a"