Path: blob/master/arch/avr32/lib/strncpy_from_user.S
10817 views
/*1* Copy to/from userspace with optional address space checking.2*3* Copyright 2004-2006 Atmel Corporation4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License version 2 as7* published by the Free Software Foundation.8*/9#include <linux/errno.h>1011#include <asm/page.h>12#include <asm/thread_info.h>13#include <asm/asm.h>1415/*16* long strncpy_from_user(char *dst, const char *src, long count)17*18* On success, returns the length of the string, not including19* the terminating NUL.20*21* If the string is longer than count, returns count22*23* If userspace access fails, returns -EFAULT24*/25.text26.align 127.global strncpy_from_user28.type strncpy_from_user, "function"29strncpy_from_user:30mov r9, -EFAULT31branch_if_kernel r8, __strncpy_from_user32ret_if_privileged r8, r11, r10, r93334.global __strncpy_from_user35.type __strncpy_from_user, "function"36__strncpy_from_user:37cp.w r10, 038reteq 03940mov r9, r1041421: ld.ub r8, r11++43st.b r12++, r844cp.w r8, 045breq 2f46sub r9, 147brne 1b48492: sub r10, r950retal r105152.section .fixup, "ax"53.align 1543: mov r12, -EFAULT55retal r125657.section __ex_table, "a"58.align 259.long 1b, 3b606162