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