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

TOMOYO Linux Cross Reference
Linux/arch/csky/abiv2/strlen.S

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ 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 */
  2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
  3 
  4 #include <linux/linkage.h>
  5 #include "sysdep.h"
  6 
  7 ENTRY(strlen)
  8         /* Check if the start addr is aligned.  */
  9         mov     r3, r0
 10         andi    r1, r0, 3
 11         movi    r2, 4
 12         movi    r0, 0
 13         bnez    r1, .L_start_not_aligned
 14 
 15         LABLE_ALIGN
 16 .L_start_addr_aligned:
 17         /* Check if all the bytes in the word are not zero.  */
 18         ldw     r1, (r3)
 19         tstnbz  r1
 20         bf      .L_string_tail
 21 
 22         ldw     r1, (r3, 4)
 23         addi    r0, 4
 24         tstnbz  r1
 25         bf      .L_string_tail
 26 
 27         ldw     r1, (r3, 8)
 28         addi    r0, 4
 29         tstnbz  r1
 30         bf      .L_string_tail
 31 
 32         ldw     r1, (r3, 12)
 33         addi    r0, 4
 34         tstnbz  r1
 35         bf      .L_string_tail
 36 
 37         ldw     r1, (r3, 16)
 38         addi    r0, 4
 39         tstnbz  r1
 40         bf      .L_string_tail
 41 
 42         ldw     r1, (r3, 20)
 43         addi    r0, 4
 44         tstnbz  r1
 45         bf      .L_string_tail
 46 
 47         ldw     r1, (r3, 24)
 48         addi    r0, 4
 49         tstnbz  r1
 50         bf      .L_string_tail
 51 
 52         ldw     r1, (r3, 28)
 53         addi    r0, 4
 54         tstnbz  r1
 55         bf      .L_string_tail
 56 
 57         addi    r0, 4
 58         addi    r3, 32
 59         br      .L_start_addr_aligned
 60 
 61 .L_string_tail:
 62 # ifdef __CSKYBE__
 63         xtrb0   r3, r1
 64         bez     r3, .L_return
 65         addi    r0, 1
 66         xtrb1   r3, r1
 67         bez     r3, .L_return
 68         addi    r0, 1
 69         xtrb2   r3, r1
 70         bez     r3, .L_return
 71         addi    r0, 1
 72 # else
 73         xtrb3   r3, r1
 74         bez     r3, .L_return
 75         addi    r0, 1
 76         xtrb2   r3, r1
 77         bez     r3, .L_return
 78         addi    r0, 1
 79         xtrb1   r3, r1
 80         bez     r3, .L_return
 81         addi    r0, 1
 82 # endif /* !__CSKYBE__ */
 83 
 84 .L_return:
 85         rts
 86 
 87 .L_start_not_aligned:
 88         sub     r2, r2, r1
 89 .L_start_not_aligned_loop:
 90         ldb     r1, (r3)
 91         PRE_BNEZAD (r2)
 92         addi    r3, 1
 93         bez     r1, .L_return
 94         addi    r0, 1
 95         BNEZAD (r2, .L_start_not_aligned_loop)
 96         br      .L_start_addr_aligned
 97 ENDPROC(strlen)

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