1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* GENpage.S: Generic clear and copy page.
4 * Copyright (C) 2007 (davem@davemloft.net)
13 1: ldx [%o1 + 0x00], %o2
39 1: stx %g0, [%o0 + 0x00]
51 #define BRANCH_ALWAYS 0x10680000
52 #define NOP 0x01000000
53 #define GEN_DO_PATCH(OLD, NEW) \
54 sethi %hi(NEW), %g1; \
55 or %g1, %lo(NEW), %g1; \
56 sethi %hi(OLD), %g2; \
57 or %g2, %lo(OLD), %g2; \
59 sethi %hi(BRANCH_ALWAYS), %g3; \
61 srl %g1, 11 + 2, %g1; \
62 or %g3, %lo(BRANCH_ALWAYS), %g3; \
65 sethi %hi(NOP), %g3; \
66 or %g3, %lo(NOP), %g3; \
67 stw %g3, [%g2 + 0x4]; \
70 .globl generic_patch_pageops
71 .type generic_patch_pageops,#function
72 generic_patch_pageops:
73 GEN_DO_PATCH(copy_user_page, GENcopy_user_page)
74 GEN_DO_PATCH(_clear_page, GENclear_page)
75 GEN_DO_PATCH(clear_user_page, GENclear_user_page)
78 .size generic_patch_pageops,.-generic_patch_pageops