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

TOMOYO Linux Cross Reference
Linux/arch/powerpc/lib/string.S

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 /*
  3  * String handling functions for PowerPC.
  4  *
  5  * Copyright (C) 1996 Paul Mackerras.
  6  */
  7 #include <linux/export.h>
  8 #include <asm/ppc_asm.h>
  9 #include <asm/cache.h>
 10 
 11         .text
 12         
 13 /* This clears out any unused part of the destination buffer,
 14    just as the libc version does.  -- paulus */
 15 _GLOBAL(strncpy)
 16         PPC_LCMPI 0,r5,0
 17         beqlr
 18         mtctr   r5
 19         addi    r6,r3,-1
 20         addi    r4,r4,-1
 21         .balign IFETCH_ALIGN_BYTES
 22 1:      lbzu    r0,1(r4)
 23         cmpwi   0,r0,0
 24         stbu    r0,1(r6)
 25         bdnzf   2,1b            /* dec ctr, branch if ctr != 0 && !cr0.eq */
 26         bnelr                   /* if we didn't hit a null char, we're done */
 27         mfctr   r5
 28         PPC_LCMPI 0,r5,0        /* any space left in destination buffer? */
 29         beqlr                   /* we know r0 == 0 here */
 30 2:      stbu    r0,1(r6)        /* clear it out if so */
 31         bdnz    2b
 32         blr
 33 EXPORT_SYMBOL(strncpy)
 34 
 35 _GLOBAL(strncmp)
 36         PPC_LCMPI 0,r5,0
 37         beq-    2f
 38         mtctr   r5
 39         addi    r5,r3,-1
 40         addi    r4,r4,-1
 41         .balign IFETCH_ALIGN_BYTES
 42 1:      lbzu    r3,1(r5)
 43         cmpwi   1,r3,0
 44         lbzu    r0,1(r4)
 45         subf.   r3,r0,r3
 46         beqlr   1
 47         bdnzt   eq,1b
 48         blr
 49 2:      li      r3,0
 50         blr
 51 EXPORT_SYMBOL(strncmp)
 52 
 53 _GLOBAL(memchr)
 54         PPC_LCMPI 0,r5,0
 55         beq-    2f
 56         mtctr   r5
 57         addi    r3,r3,-1
 58         .balign IFETCH_ALIGN_BYTES
 59 1:      lbzu    r0,1(r3)
 60         cmpw    0,r0,r4
 61         bdnzf   2,1b
 62         beqlr
 63 2:      li      r3,0
 64         blr
 65 EXPORT_SYMBOL(memchr)

~ [ 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