Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  *  linux/arch/arm/lib/copypage.S
0004  *
0005  *  Copyright (C) 1995-1999 Russell King
0006  *
0007  *  ASM optimised string functions
0008  */
0009 #include <linux/linkage.h>
0010 #include <asm/assembler.h>
0011 #include <asm/asm-offsets.h>
0012 #include <asm/cache.h>
0013 
0014 #define COPY_COUNT (PAGE_SZ / (2 * L1_CACHE_BYTES) PLD( -1 ))
0015 
0016         .text
0017         .align  5
0018 /*
0019  * StrongARM optimised copy_page routine
0020  * now 1.78bytes/cycle, was 1.60 bytes/cycle (50MHz bus -> 89MB/s)
0021  * Note that we probably achieve closer to the 100MB/s target with
0022  * the core clock switching.
0023  */
0024 ENTRY(copy_page)
0025         stmfd   sp!, {r4, lr}           @   2
0026     PLD(    pld [r1, #0]        )
0027     PLD(    pld [r1, #L1_CACHE_BYTES]       )
0028         mov r2, #COPY_COUNT         @   1
0029         ldmia   r1!, {r3, r4, ip, lr}       @   4+1
0030 1:  PLD(    pld [r1, #2 * L1_CACHE_BYTES])
0031     PLD(    pld [r1, #3 * L1_CACHE_BYTES])
0032 2:
0033     .rept   (2 * L1_CACHE_BYTES / 16 - 1)
0034         stmia   r0!, {r3, r4, ip, lr}       @   4
0035         ldmia   r1!, {r3, r4, ip, lr}       @   4
0036     .endr
0037         subs    r2, r2, #1          @   1
0038         stmia   r0!, {r3, r4, ip, lr}       @   4
0039         ldmiagt r1!, {r3, r4, ip, lr}       @   4
0040         bgt 1b              @   1
0041     PLD(    ldmiaeq r1!, {r3, r4, ip, lr}   )
0042     PLD(    beq 2b          )
0043         ldmfd   sp!, {r4, pc}           @   3
0044 ENDPROC(copy_page)