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

TOMOYO Linux Cross Reference
Linux/arch/csky/abiv2/memmove.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         .weak memmove
  8 ENTRY(__memmove)
  9 ENTRY(memmove)
 10         subu    r3, r0, r1
 11         cmphs   r3, r2
 12         bt      memcpy
 13 
 14         mov     r12, r0
 15         addu    r0, r0, r2
 16         addu    r1, r1, r2
 17 
 18         /* Test if len less than 4 bytes.  */
 19         cmplti  r2, 4
 20         bt      .L_copy_by_byte
 21 
 22         andi    r13, r0, 3
 23         /* Test if dest is not 4 bytes aligned.  */
 24         bnez    r13, .L_dest_not_aligned
 25         /* Hardware can handle unaligned access directly.  */
 26 .L_dest_aligned:
 27         /* If dest is aligned, then copy.  */
 28         zext    r18, r2, 31, 4
 29         /* Test if len less than 16 bytes.  */
 30         bez     r18, .L_len_less_16bytes
 31         movi    r19, 0
 32 
 33         /* len > 16 bytes */
 34         LABLE_ALIGN
 35 .L_len_larger_16bytes:
 36         subi    r1, 16
 37         subi    r0, 16
 38 #if defined(__CK860__)
 39         ldw     r3, (r1, 12)
 40         stw     r3, (r0, 12)
 41         ldw     r3, (r1, 8)
 42         stw     r3, (r0, 8)
 43         ldw     r3, (r1, 4)
 44         stw     r3, (r0, 4)
 45         ldw     r3, (r1, 0)
 46         stw     r3, (r0, 0)
 47 #else
 48         ldw     r20, (r1, 0)
 49         ldw     r21, (r1, 4)
 50         ldw     r22, (r1, 8)
 51         ldw     r23, (r1, 12)
 52         stw     r20, (r0, 0)
 53         stw     r21, (r0, 4)
 54         stw     r22, (r0, 8)
 55         stw     r23, (r0, 12)
 56         PRE_BNEZAD (r18)
 57 #endif
 58         BNEZAD (r18, .L_len_larger_16bytes)
 59 
 60 .L_len_less_16bytes:
 61         zext    r18, r2, 3, 2
 62         bez     r18, .L_copy_by_byte
 63 .L_len_less_16bytes_loop:
 64         subi    r1, 4
 65         subi    r0, 4
 66         ldw     r3, (r1, 0)
 67         PRE_BNEZAD (r18)
 68         stw     r3, (r0, 0)
 69         BNEZAD (r18, .L_len_less_16bytes_loop)
 70 
 71         /* Test if len less than 4 bytes.  */
 72 .L_copy_by_byte:
 73         zext    r18, r2, 1, 0
 74         bez     r18, .L_return
 75 .L_copy_by_byte_loop:
 76         subi    r1, 1
 77         subi    r0, 1
 78         ldb     r3, (r1, 0)
 79         PRE_BNEZAD (r18)
 80         stb     r3, (r0, 0)
 81         BNEZAD (r18, .L_copy_by_byte_loop)
 82 
 83 .L_return:
 84         mov     r0, r12
 85         rts
 86 
 87         /* If dest is not aligned, just copy some bytes makes the dest
 88            align.  */
 89 .L_dest_not_aligned:
 90         sub     r2, r13
 91 .L_dest_not_aligned_loop:
 92         subi    r1, 1
 93         subi    r0, 1
 94         /* Makes the dest align.  */
 95         ldb     r3, (r1, 0)
 96         PRE_BNEZAD (r13)
 97         stb     r3, (r0, 0)
 98         BNEZAD (r13, .L_dest_not_aligned_loop)
 99         cmplti  r2, 4
100         bt      .L_copy_by_byte
101         /* Check whether the src is aligned.  */
102         jbr     .L_dest_aligned
103 ENDPROC(memmove)
104 ENDPROC(__memmove)

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