1 /* NG4patch.S: Patch Ultra-I routines with Niagara-4 variant.
3 * Copyright (C) 2012 David S. Miller <davem@davemloft.net>
6 #define BRANCH_ALWAYS 0x10680000
8 #define NG_DO_PATCH(OLD, NEW) \
10 or %g1, %lo(NEW), %g1; \
11 sethi %hi(OLD), %g2; \
12 or %g2, %lo(OLD), %g2; \
14 sethi %hi(BRANCH_ALWAYS), %g3; \
16 srl %g1, 11 + 2, %g1; \
17 or %g3, %lo(BRANCH_ALWAYS), %g3; \
20 sethi %hi(NOP), %g3; \
21 or %g3, %lo(NOP), %g3; \
22 stw %g3, [%g2 + 0x4]; \
25 .globl niagara4_patch_copyops
26 .type niagara4_patch_copyops,#function
27 niagara4_patch_copyops:
28 NG_DO_PATCH(memcpy, NG4memcpy)
29 NG_DO_PATCH(___copy_from_user, NG4copy_from_user)
30 NG_DO_PATCH(___copy_to_user, NG4copy_to_user)
33 .size niagara4_patch_copyops,.-niagara4_patch_copyops
35 .globl niagara4_patch_bzero
36 .type niagara4_patch_bzero,#function
38 NG_DO_PATCH(memset, NG4memset)
39 NG_DO_PATCH(__bzero, NG4bzero)
40 NG_DO_PATCH(__clear_user, NGclear_user)
41 NG_DO_PATCH(tsb_init, NGtsb_init)
44 .size niagara4_patch_bzero,.-niagara4_patch_bzero
46 .globl niagara4_patch_pageops
47 .type niagara4_patch_pageops,#function
48 niagara4_patch_pageops:
49 NG_DO_PATCH(copy_user_page, NG4copy_user_page)
50 NG_DO_PATCH(_clear_page, NG4clear_page)
51 NG_DO_PATCH(clear_user_page, NG4clear_user_page)
54 .size niagara4_patch_pageops,.-niagara4_patch_pageops