~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/mips/lib/strncpy_user.S

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  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
  4  * for more details.
  5  *
  6  * Copyright (C) 1996, 1999 by Ralf Baechle
  7  * Copyright (C) 2011 MIPS Technologies, Inc.
  8  */
  9 #include <linux/errno.h>
 10 #include <linux/export.h>
 11 #include <asm/asm.h>
 12 #include <asm/asm-offsets.h>
 13 #include <asm/regdef.h>
 14 
 15 #define EX(insn,reg,addr,handler)                       \
 16 9:      insn    reg, addr;                              \
 17         .section __ex_table,"a";                        \
 18         PTR_WD  9b, handler;                            \
 19         .previous
 20 
 21 /*
 22  * Returns: -EFAULT if exception before terminator, N if the entire
 23  * buffer filled, else strlen.
 24  */
 25 
 26 /*
 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.
 30  */
 31 
 32 LEAF(__strncpy_from_user_asm)
 33         move            t0, zero
 34         move            v1, a1
 35 #ifdef CONFIG_EVA
 36         .set push
 37         .set eva
 38 1:      EX(lbue, v0, (v1), .Lfault)
 39         .set pop
 40 #else
 41 1:      EX(lbu, v0, (v1), .Lfault)
 42 #endif
 43         PTR_ADDIU       v1, 1
 44         R10KCBARRIER(0(ra))
 45         sb              v0, (a0)
 46         beqz            v0, 2f
 47         PTR_ADDIU       t0, 1
 48         PTR_ADDIU       a0, 1
 49         bne             t0, a2, 1b
 50 2:      PTR_ADDU        v0, a1, t0
 51         xor             v0, a1
 52         bltz            v0, .Lfault
 53         move            v0, t0
 54         jr              ra                      # return n
 55         END(__strncpy_from_user_asm)
 56 
 57 .Lfault:
 58         li              v0, -EFAULT
 59         jr              ra
 60 
 61         .section        __ex_table,"a"
 62         PTR_WD          1b, .Lfault
 63         .previous
 64 
 65         EXPORT_SYMBOL(__strncpy_from_user_asm)

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php