1 /* SPDX-License-Identifier: GPL-2.0 */ << 2 /* GENpage.S: Generic clear and copy page. 1 /* GENpage.S: Generic clear and copy page. 3 * 2 * 4 * Copyright (C) 2007 (davem@davemloft.net) 3 * Copyright (C) 2007 (davem@davemloft.net) 5 */ 4 */ 6 #include <asm/page.h> 5 #include <asm/page.h> 7 6 8 .text 7 .text 9 .align 32 8 .align 32 10 9 11 GENcopy_user_page: 10 GENcopy_user_page: 12 set PAGE_SIZE, %g7 11 set PAGE_SIZE, %g7 13 1: ldx [%o1 + 0x00], %o2 12 1: ldx [%o1 + 0x00], %o2 14 ldx [%o1 + 0x08], %o3 13 ldx [%o1 + 0x08], %o3 15 ldx [%o1 + 0x10], %o4 14 ldx [%o1 + 0x10], %o4 16 ldx [%o1 + 0x18], %o5 15 ldx [%o1 + 0x18], %o5 17 stx %o2, [%o0 + 0x00] 16 stx %o2, [%o0 + 0x00] 18 stx %o3, [%o0 + 0x08] 17 stx %o3, [%o0 + 0x08] 19 stx %o4, [%o0 + 0x10] 18 stx %o4, [%o0 + 0x10] 20 stx %o5, [%o0 + 0x18] 19 stx %o5, [%o0 + 0x18] 21 ldx [%o1 + 0x20], %o2 20 ldx [%o1 + 0x20], %o2 22 ldx [%o1 + 0x28], %o3 21 ldx [%o1 + 0x28], %o3 23 ldx [%o1 + 0x30], %o4 22 ldx [%o1 + 0x30], %o4 24 ldx [%o1 + 0x38], %o5 23 ldx [%o1 + 0x38], %o5 25 stx %o2, [%o0 + 0x20] 24 stx %o2, [%o0 + 0x20] 26 stx %o3, [%o0 + 0x28] 25 stx %o3, [%o0 + 0x28] 27 stx %o4, [%o0 + 0x30] 26 stx %o4, [%o0 + 0x30] 28 stx %o5, [%o0 + 0x38] 27 stx %o5, [%o0 + 0x38] 29 subcc %g7, 64, %g7 28 subcc %g7, 64, %g7 30 add %o1, 64, %o1 29 add %o1, 64, %o1 31 bne,pt %xcc, 1b 30 bne,pt %xcc, 1b 32 add %o0, 64, %o0 31 add %o0, 64, %o0 33 retl 32 retl 34 nop 33 nop 35 34 36 GENclear_page: 35 GENclear_page: 37 GENclear_user_page: 36 GENclear_user_page: 38 set PAGE_SIZE, %g7 37 set PAGE_SIZE, %g7 39 1: stx %g0, [%o0 + 0x00] 38 1: stx %g0, [%o0 + 0x00] 40 stx %g0, [%o0 + 0x08] 39 stx %g0, [%o0 + 0x08] 41 stx %g0, [%o0 + 0x10] 40 stx %g0, [%o0 + 0x10] 42 stx %g0, [%o0 + 0x18] 41 stx %g0, [%o0 + 0x18] 43 stx %g0, [%o0 + 0x20] 42 stx %g0, [%o0 + 0x20] 44 stx %g0, [%o0 + 0x28] 43 stx %g0, [%o0 + 0x28] 45 stx %g0, [%o0 + 0x30] 44 stx %g0, [%o0 + 0x30] 46 stx %g0, [%o0 + 0x38] 45 stx %g0, [%o0 + 0x38] 47 subcc %g7, 64, %g7 46 subcc %g7, 64, %g7 48 bne,pt %xcc, 1b 47 bne,pt %xcc, 1b 49 add %o0, 64, %o0 48 add %o0, 64, %o0 50 49 51 #define BRANCH_ALWAYS 0x10680000 50 #define BRANCH_ALWAYS 0x10680000 52 #define NOP 0x01000000 51 #define NOP 0x01000000 53 #define GEN_DO_PATCH(OLD, NEW) \ 52 #define GEN_DO_PATCH(OLD, NEW) \ 54 sethi %hi(NEW), %g1; \ 53 sethi %hi(NEW), %g1; \ 55 or %g1, %lo(NEW), %g1; \ 54 or %g1, %lo(NEW), %g1; \ 56 sethi %hi(OLD), %g2; \ 55 sethi %hi(OLD), %g2; \ 57 or %g2, %lo(OLD), %g2; \ 56 or %g2, %lo(OLD), %g2; \ 58 sub %g1, %g2, %g1; \ 57 sub %g1, %g2, %g1; \ 59 sethi %hi(BRANCH_ALWAYS), %g3; \ 58 sethi %hi(BRANCH_ALWAYS), %g3; \ 60 sll %g1, 11, %g1; \ 59 sll %g1, 11, %g1; \ 61 srl %g1, 11 + 2, %g1; \ 60 srl %g1, 11 + 2, %g1; \ 62 or %g3, %lo(BRANCH_ALWAYS), %g3; 61 or %g3, %lo(BRANCH_ALWAYS), %g3; \ 63 or %g3, %g1, %g3; \ 62 or %g3, %g1, %g3; \ 64 stw %g3, [%g2]; \ 63 stw %g3, [%g2]; \ 65 sethi %hi(NOP), %g3; \ 64 sethi %hi(NOP), %g3; \ 66 or %g3, %lo(NOP), %g3; \ 65 or %g3, %lo(NOP), %g3; \ 67 stw %g3, [%g2 + 0x4]; \ 66 stw %g3, [%g2 + 0x4]; \ 68 flush %g2; 67 flush %g2; 69 68 70 .globl generic_patch_pageops 69 .globl generic_patch_pageops 71 .type generic_patch_pageops,#functio 70 .type generic_patch_pageops,#function 72 generic_patch_pageops: 71 generic_patch_pageops: 73 GEN_DO_PATCH(copy_user_page, GENcopy_u 72 GEN_DO_PATCH(copy_user_page, GENcopy_user_page) 74 GEN_DO_PATCH(_clear_page, GENclear_pag 73 GEN_DO_PATCH(_clear_page, GENclear_page) 75 GEN_DO_PATCH(clear_user_page, GENclear 74 GEN_DO_PATCH(clear_user_page, GENclear_user_page) 76 retl 75 retl 77 nop 76 nop 78 .size generic_patch_pageops,.-generi 77 .size generic_patch_pageops,.-generic_patch_pageops
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.