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 ENTRY(m7_patch_copyops)
0029 NG_DO_PATCH(memcpy, M7memcpy)
0030 NG_DO_PATCH(raw_copy_from_user, M7copy_from_user)
0031 NG_DO_PATCH(raw_copy_to_user, M7copy_to_user)
0032 retl
0033 nop
0034 ENDPROC(m7_patch_copyops)
0035
0036 ENTRY(m7_patch_bzero)
0037 NG_DO_PATCH(memset, M7memset)
0038 NG_DO_PATCH(__bzero, M7bzero)
0039 NG_DO_PATCH(__clear_user, NGclear_user)
0040 NG_DO_PATCH(tsb_init, NGtsb_init)
0041 retl
0042 nop
0043 ENDPROC(m7_patch_bzero)
0044
0045 ENTRY(m7_patch_pageops)
0046 NG_DO_PATCH(copy_user_page, NG4copy_user_page)
0047 NG_DO_PATCH(_clear_page, M7clear_page)
0048 NG_DO_PATCH(clear_user_page, M7clear_user_page)
0049 retl
0050 nop
0051 ENDPROC(m7_patch_pageops)