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

TOMOYO Linux Cross Reference
Linux/arch/riscv/kernel/copy-unaligned.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 /* SPDX-License-Identifier: GPL-2.0 */
  2 /* Copyright (C) 2023 Rivos Inc. */
  3 
  4 #include <linux/linkage.h>
  5 #include <asm/asm.h>
  6 
  7         .text
  8 
  9 /* void __riscv_copy_words_unaligned(void *, const void *, size_t) */
 10 /* Performs a memcpy without aligning buffers, using word loads and stores. */
 11 /* Note: The size is truncated to a multiple of 8 * SZREG */
 12 SYM_FUNC_START(__riscv_copy_words_unaligned)
 13         andi  a4, a2, ~((8*SZREG)-1)
 14         beqz  a4, 2f
 15         add   a3, a1, a4
 16 1:
 17         REG_L a4,       0(a1)
 18         REG_L a5,   SZREG(a1)
 19         REG_L a6, 2*SZREG(a1)
 20         REG_L a7, 3*SZREG(a1)
 21         REG_L t0, 4*SZREG(a1)
 22         REG_L t1, 5*SZREG(a1)
 23         REG_L t2, 6*SZREG(a1)
 24         REG_L t3, 7*SZREG(a1)
 25         REG_S a4,       0(a0)
 26         REG_S a5,   SZREG(a0)
 27         REG_S a6, 2*SZREG(a0)
 28         REG_S a7, 3*SZREG(a0)
 29         REG_S t0, 4*SZREG(a0)
 30         REG_S t1, 5*SZREG(a0)
 31         REG_S t2, 6*SZREG(a0)
 32         REG_S t3, 7*SZREG(a0)
 33         addi  a0, a0, 8*SZREG
 34         addi  a1, a1, 8*SZREG
 35         bltu  a1, a3, 1b
 36 
 37 2:
 38         ret
 39 SYM_FUNC_END(__riscv_copy_words_unaligned)
 40 
 41 /* void __riscv_copy_bytes_unaligned(void *, const void *, size_t) */
 42 /* Performs a memcpy without aligning buffers, using only byte accesses. */
 43 /* Note: The size is truncated to a multiple of 8 */
 44 SYM_FUNC_START(__riscv_copy_bytes_unaligned)
 45         andi a4, a2, ~(8-1)
 46         beqz a4, 2f
 47         add  a3, a1, a4
 48 1:
 49         lb   a4, 0(a1)
 50         lb   a5, 1(a1)
 51         lb   a6, 2(a1)
 52         lb   a7, 3(a1)
 53         lb   t0, 4(a1)
 54         lb   t1, 5(a1)
 55         lb   t2, 6(a1)
 56         lb   t3, 7(a1)
 57         sb   a4, 0(a0)
 58         sb   a5, 1(a0)
 59         sb   a6, 2(a0)
 60         sb   a7, 3(a0)
 61         sb   t0, 4(a0)
 62         sb   t1, 5(a0)
 63         sb   t2, 6(a0)
 64         sb   t3, 7(a0)
 65         addi a0, a0, 8
 66         addi a1, a1, 8
 67         bltu a1, a3, 1b
 68 
 69 2:
 70         ret
 71 SYM_FUNC_END(__riscv_copy_bytes_unaligned)

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