Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* GENpage.S: Generic clear and copy page.
0003  *
0004  * Copyright (C) 2007 (davem@davemloft.net)
0005  */
0006 #include <asm/page.h>
0007 
0008     .text
0009     .align  32
0010 
0011 GENcopy_user_page:
0012     set PAGE_SIZE, %g7
0013 1:  ldx [%o1 + 0x00], %o2
0014     ldx [%o1 + 0x08], %o3
0015     ldx [%o1 + 0x10], %o4
0016     ldx [%o1 + 0x18], %o5
0017     stx %o2, [%o0 + 0x00]
0018     stx %o3, [%o0 + 0x08]
0019     stx %o4, [%o0 + 0x10]
0020     stx %o5, [%o0 + 0x18]
0021     ldx [%o1 + 0x20], %o2
0022     ldx [%o1 + 0x28], %o3
0023     ldx [%o1 + 0x30], %o4
0024     ldx [%o1 + 0x38], %o5
0025     stx %o2, [%o0 + 0x20]
0026     stx %o3, [%o0 + 0x28]
0027     stx %o4, [%o0 + 0x30]
0028     stx %o5, [%o0 + 0x38]
0029     subcc   %g7, 64, %g7
0030     add %o1, 64, %o1
0031     bne,pt  %xcc, 1b
0032      add    %o0, 64, %o0
0033     retl
0034      nop
0035 
0036 GENclear_page:
0037 GENclear_user_page:
0038     set PAGE_SIZE, %g7
0039 1:  stx %g0, [%o0 + 0x00]
0040     stx %g0, [%o0 + 0x08]
0041     stx %g0, [%o0 + 0x10]
0042     stx %g0, [%o0 + 0x18]
0043     stx %g0, [%o0 + 0x20]
0044     stx %g0, [%o0 + 0x28]
0045     stx %g0, [%o0 + 0x30]
0046     stx %g0, [%o0 + 0x38]
0047     subcc   %g7, 64, %g7
0048     bne,pt  %xcc, 1b
0049      add    %o0, 64, %o0
0050 
0051 #define BRANCH_ALWAYS   0x10680000
0052 #define NOP     0x01000000
0053 #define GEN_DO_PATCH(OLD, NEW)  \
0054     sethi   %hi(NEW), %g1; \
0055     or  %g1, %lo(NEW), %g1; \
0056     sethi   %hi(OLD), %g2; \
0057     or  %g2, %lo(OLD), %g2; \
0058     sub %g1, %g2, %g1; \
0059     sethi   %hi(BRANCH_ALWAYS), %g3; \
0060     sll %g1, 11, %g1; \
0061     srl %g1, 11 + 2, %g1; \
0062     or  %g3, %lo(BRANCH_ALWAYS), %g3; \
0063     or  %g3, %g1, %g3; \
0064     stw %g3, [%g2]; \
0065     sethi   %hi(NOP), %g3; \
0066     or  %g3, %lo(NOP), %g3; \
0067     stw %g3, [%g2 + 0x4]; \
0068     flush   %g2;
0069 
0070     .globl  generic_patch_pageops
0071     .type   generic_patch_pageops,#function
0072 generic_patch_pageops:
0073     GEN_DO_PATCH(copy_user_page, GENcopy_user_page)
0074     GEN_DO_PATCH(_clear_page, GENclear_page)
0075     GEN_DO_PATCH(clear_user_page, GENclear_user_page)
0076     retl
0077      nop
0078     .size   generic_patch_pageops,.-generic_patch_pageops