copy_page.S 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * linux/arch/arm/lib/copypage.S
  4. *
  5. * Copyright (C) 1995-1999 Russell King
  6. *
  7. * ASM optimised string functions
  8. */
  9. #include <linux/linkage.h>
  10. #include <asm/assembler.h>
  11. #include <asm/asm-offsets.h>
  12. #include <asm/cache.h>
  13. #define COPY_COUNT (PAGE_SZ / (2 * L1_CACHE_BYTES) PLD( -1 ))
  14. .text
  15. .align 5
  16. /*
  17. * StrongARM optimised copy_page routine
  18. * now 1.78bytes/cycle, was 1.60 bytes/cycle (50MHz bus -> 89MB/s)
  19. * Note that we probably achieve closer to the 100MB/s target with
  20. * the core clock switching.
  21. */
  22. ENTRY(copy_page)
  23. stmfd sp!, {r4, lr} @ 2
  24. PLD( pld [r1, #0] )
  25. PLD( pld [r1, #L1_CACHE_BYTES] )
  26. mov r2, #COPY_COUNT @ 1
  27. ldmia r1!, {r3, r4, ip, lr} @ 4+1
  28. 1: PLD( pld [r1, #2 * L1_CACHE_BYTES])
  29. PLD( pld [r1, #3 * L1_CACHE_BYTES])
  30. 2:
  31. .rept (2 * L1_CACHE_BYTES / 16 - 1)
  32. stmia r0!, {r3, r4, ip, lr} @ 4
  33. ldmia r1!, {r3, r4, ip, lr} @ 4
  34. .endr
  35. subs r2, r2, #1 @ 1
  36. stmia r0!, {r3, r4, ip, lr} @ 4
  37. ldmiagt r1!, {r3, r4, ip, lr} @ 4
  38. bgt 1b @ 1
  39. PLD( ldmiaeq r1!, {r3, r4, ip, lr} )
  40. PLD( beq 2b )
  41. ldmfd sp!, {r4, pc} @ 3
  42. ENDPROC(copy_page)