Thomas Gleixner | d2912cb | 2019-06-04 10:11:33 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /* |
| 3 | * linux/arch/arm/lib/copypage.S |
| 4 | * |
| 5 | * Copyright (C) 1995-1999 Russell King |
| 6 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * ASM optimised string functions |
| 8 | */ |
| 9 | #include <linux/linkage.h> |
| 10 | #include <asm/assembler.h> |
Sam Ravnborg | e6ae744 | 2005-09-09 21:08:59 +0200 | [diff] [blame] | 11 | #include <asm/asm-offsets.h> |
Kirill A. Shutemov | dca230f | 2009-09-15 10:26:33 +0100 | [diff] [blame] | 12 | #include <asm/cache.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | |
Kirill A. Shutemov | dca230f | 2009-09-15 10:26:33 +0100 | [diff] [blame] | 14 | #define COPY_COUNT (PAGE_SZ / (2 * L1_CACHE_BYTES) PLD( -1 )) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | |
| 16 | .text |
| 17 | .align 5 |
| 18 | /* |
| 19 | * StrongARM optimised copy_page routine |
| 20 | * now 1.78bytes/cycle, was 1.60 bytes/cycle (50MHz bus -> 89MB/s) |
| 21 | * Note that we probably achieve closer to the 100MB/s target with |
| 22 | * the core clock switching. |
| 23 | */ |
| 24 | ENTRY(copy_page) |
| 25 | stmfd sp!, {r4, lr} @ 2 |
| 26 | PLD( pld [r1, #0] ) |
Kirill A. Shutemov | dca230f | 2009-09-15 10:26:33 +0100 | [diff] [blame] | 27 | PLD( pld [r1, #L1_CACHE_BYTES] ) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | mov r2, #COPY_COUNT @ 1 |
| 29 | ldmia r1!, {r3, r4, ip, lr} @ 4+1 |
Kirill A. Shutemov | dca230f | 2009-09-15 10:26:33 +0100 | [diff] [blame] | 30 | 1: PLD( pld [r1, #2 * L1_CACHE_BYTES]) |
| 31 | PLD( pld [r1, #3 * L1_CACHE_BYTES]) |
| 32 | 2: |
| 33 | .rept (2 * L1_CACHE_BYTES / 16 - 1) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | stmia r0!, {r3, r4, ip, lr} @ 4 |
| 35 | ldmia r1!, {r3, r4, ip, lr} @ 4 |
Kirill A. Shutemov | dca230f | 2009-09-15 10:26:33 +0100 | [diff] [blame] | 36 | .endr |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | subs r2, r2, #1 @ 1 |
| 38 | stmia r0!, {r3, r4, ip, lr} @ 4 |
Stefan Agner | e44fc38 | 2019-02-18 00:57:38 +0100 | [diff] [blame] | 39 | ldmiagt r1!, {r3, r4, ip, lr} @ 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | bgt 1b @ 1 |
Stefan Agner | e44fc38 | 2019-02-18 00:57:38 +0100 | [diff] [blame] | 41 | PLD( ldmiaeq r1!, {r3, r4, ip, lr} ) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | PLD( beq 2b ) |
Russell King | 1b93a71 | 2006-06-25 11:23:45 +0100 | [diff] [blame] | 43 | ldmfd sp!, {r4, pc} @ 3 |
Catalin Marinas | 93ed397 | 2008-08-28 11:22:32 +0100 | [diff] [blame] | 44 | ENDPROC(copy_page) |