0001
0002
0003
0004
0005
0006
0007 #include <linux/linkage.h>
0008
0009 #define BRANCH_ALWAYS 0x10680000
0010 #define NOP 0x01000000
0011 #define NG_DO_PATCH(OLD, NEW) \
0012 sethi %hi(NEW), %g1; \
0013 or %g1, %lo(NEW), %g1; \
0014 sethi %hi(OLD), %g2; \
0015 or %g2, %lo(OLD), %g2; \
0016 sub %g1, %g2, %g1; \
0017 sethi %hi(BRANCH_ALWAYS), %g3; \
0018 sll %g1, 11, %g1; \
0019 srl %g1, 11 + 2, %g1; \
0020 or %g3, %lo(BRANCH_ALWAYS), %g3; \
0021 or %g3, %g1, %g3; \
0022 stw %g3, [%g2]; \
0023 sethi %hi(NOP), %g3; \
0024 or %g3, %lo(NOP), %g3; \
0025 stw %g3, [%g2 + 0x4]; \
0026 flush %g2;
0027
0028 .globl niagara4_patch_copyops
0029 .type niagara4_patch_copyops,#function
0030 niagara4_patch_copyops:
0031 NG_DO_PATCH(memcpy, NG4memcpy)
0032 NG_DO_PATCH(raw_copy_from_user, NG4copy_from_user)
0033 NG_DO_PATCH(raw_copy_to_user, NG4copy_to_user)
0034 retl
0035 nop
0036 .size niagara4_patch_copyops,.-niagara4_patch_copyops
0037
0038 .globl niagara4_patch_bzero
0039 .type niagara4_patch_bzero,#function
0040 niagara4_patch_bzero:
0041 NG_DO_PATCH(memset, NG4memset)
0042 NG_DO_PATCH(__bzero, NG4bzero)
0043 NG_DO_PATCH(__clear_user, NGclear_user)
0044 NG_DO_PATCH(tsb_init, NGtsb_init)
0045 retl
0046 nop
0047 .size niagara4_patch_bzero,.-niagara4_patch_bzero
0048
0049 .globl niagara4_patch_pageops
0050 .type niagara4_patch_pageops,#function
0051 niagara4_patch_pageops:
0052 NG_DO_PATCH(copy_user_page, NG4copy_user_page)
0053 NG_DO_PATCH(_clear_page, NG4clear_page)
0054 NG_DO_PATCH(clear_user_page, NG4clear_user_page)
0055 retl
0056 nop
0057 .size niagara4_patch_pageops,.-niagara4_patch_pageops
0058
0059 ENTRY(niagara4_patch_fls)
0060 NG_DO_PATCH(fls, NG4fls)
0061 NG_DO_PATCH(__fls, __NG4fls)
0062 retl
0063 nop
0064 ENDPROC(niagara4_patch_fls)