Path: blob/master/arch/arm/lib/strncpy_from_user.S
10817 views
/*1* linux/arch/arm/lib/strncpy_from_user.S2*3* Copyright (C) 1995-2000 Russell King4*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/linkage.h>10#include <asm/assembler.h>11#include <asm/errno.h>1213.text14.align 51516/*17* Copy a string from user space to kernel space.18* r0 = dst, r1 = src, r2 = byte length19* returns the number of characters copied (strlen of copied string),20* -EFAULT on exception, or "len" if we fill the whole buffer21*/22ENTRY(__strncpy_from_user)23mov ip, r1241: subs r2, r2, #125ldrusr r3, r1, 1, pl26bmi 2f27strb r3, [r0], #128teq r3, #029bne 1b30sub r1, r1, #1 @ take NUL character out of count312: sub r0, r1, ip32mov pc, lr33ENDPROC(__strncpy_from_user)3435.pushsection .fixup,"ax"36.align 0379001: mov r3, #038strb r3, [r0, #0] @ null terminate39mov r0, #-EFAULT40mov pc, lr41.popsection42434445