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