Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * Copyright (C) 2008 Mark Nelson, IBM Corp.
0004  */
0005 #include <asm/page.h>
0006 #include <asm/processor.h>
0007 #include <asm/ppc_asm.h>
0008 #include <asm/asm-offsets.h>
0009 #include <asm/export.h>
0010 #include <asm/feature-fixups.h>
0011 
0012         .section        ".toc","aw"
0013 PPC64_CACHES:
0014         .tc             ppc64_caches[TC],ppc64_caches
0015         .section        ".text"
0016 
0017 _GLOBAL_TOC(copy_page)
0018 BEGIN_FTR_SECTION
0019     lis r5,PAGE_SIZE@h
0020 FTR_SECTION_ELSE
0021 #ifdef CONFIG_PPC_BOOK3S_64
0022     b   copypage_power7
0023 #endif
0024 ALT_FTR_SECTION_END_IFCLR(CPU_FTR_VMX_COPY)
0025     ori r5,r5,PAGE_SIZE@l
0026 BEGIN_FTR_SECTION
0027     ld      r10,PPC64_CACHES@toc(r2)
0028     lwz r11,DCACHEL1LOGBLOCKSIZE(r10)   /* log2 of cache block size */
0029     lwz     r12,DCACHEL1BLOCKSIZE(r10)  /* get cache block size */
0030     li  r9,0
0031     srd r8,r5,r11
0032 
0033     mtctr   r8
0034 .Lsetup:
0035     dcbt    r9,r4
0036     dcbz    r9,r3
0037     add r9,r9,r12
0038     bdnz    .Lsetup
0039 END_FTR_SECTION_IFSET(CPU_FTR_CP_USE_DCBTZ)
0040     addi    r3,r3,-8
0041     srdi    r8,r5,7     /* page is copied in 128 byte strides */
0042     addi    r8,r8,-1    /* one stride copied outside loop */
0043 
0044     mtctr   r8
0045 
0046     ld  r5,0(r4)
0047     ld  r6,8(r4)
0048     ld  r7,16(r4)
0049     ldu r8,24(r4)
0050 1:  std r5,8(r3)
0051     std r6,16(r3)
0052     ld  r9,8(r4)
0053     ld  r10,16(r4)
0054     std r7,24(r3)
0055     std r8,32(r3)
0056     ld  r11,24(r4)
0057     ld  r12,32(r4)
0058     std r9,40(r3)
0059     std r10,48(r3)
0060     ld  r5,40(r4)
0061     ld  r6,48(r4)
0062     std r11,56(r3)
0063     std r12,64(r3)
0064     ld  r7,56(r4)
0065     ld  r8,64(r4)
0066     std r5,72(r3)
0067     std r6,80(r3)
0068     ld  r9,72(r4)
0069     ld  r10,80(r4)
0070     std r7,88(r3)
0071     std r8,96(r3)
0072     ld  r11,88(r4)
0073     ld  r12,96(r4)
0074     std r9,104(r3)
0075     std r10,112(r3)
0076     ld  r5,104(r4)
0077     ld  r6,112(r4)
0078     std r11,120(r3)
0079     stdu    r12,128(r3)
0080     ld  r7,120(r4)
0081     ldu r8,128(r4)
0082     bdnz    1b
0083 
0084     std r5,8(r3)
0085     std r6,16(r3)
0086     ld  r9,8(r4)
0087     ld  r10,16(r4)
0088     std r7,24(r3)
0089     std r8,32(r3)
0090     ld  r11,24(r4)
0091     ld  r12,32(r4)
0092     std r9,40(r3)
0093     std r10,48(r3)
0094     ld  r5,40(r4)
0095     ld  r6,48(r4)
0096     std r11,56(r3)
0097     std r12,64(r3)
0098     ld  r7,56(r4)
0099     ld  r8,64(r4)
0100     std r5,72(r3)
0101     std r6,80(r3)
0102     ld  r9,72(r4)
0103     ld  r10,80(r4)
0104     std r7,88(r3)
0105     std r8,96(r3)
0106     ld  r11,88(r4)
0107     ld  r12,96(r4)
0108     std r9,104(r3)
0109     std r10,112(r3)
0110     std r11,120(r3)
0111     std r12,128(r3)
0112     blr
0113 EXPORT_SYMBOL(copy_page)