Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* NG2patch.S: Patch Ultra-I routines with Niagara-2 variant.
0003  *
0004  * Copyright (C) 2007 David S. Miller <davem@davemloft.net>
0005  */
0006 
0007 #define BRANCH_ALWAYS   0x10680000
0008 #define NOP     0x01000000
0009 #define NG_DO_PATCH(OLD, NEW)   \
0010     sethi   %hi(NEW), %g1; \
0011     or  %g1, %lo(NEW), %g1; \
0012     sethi   %hi(OLD), %g2; \
0013     or  %g2, %lo(OLD), %g2; \
0014     sub %g1, %g2, %g1; \
0015     sethi   %hi(BRANCH_ALWAYS), %g3; \
0016     sll %g1, 11, %g1; \
0017     srl %g1, 11 + 2, %g1; \
0018     or  %g3, %lo(BRANCH_ALWAYS), %g3; \
0019     or  %g3, %g1, %g3; \
0020     stw %g3, [%g2]; \
0021     sethi   %hi(NOP), %g3; \
0022     or  %g3, %lo(NOP), %g3; \
0023     stw %g3, [%g2 + 0x4]; \
0024     flush   %g2;
0025 
0026     .globl  niagara2_patch_copyops
0027     .type   niagara2_patch_copyops,#function
0028 niagara2_patch_copyops:
0029     NG_DO_PATCH(memcpy, NG2memcpy)
0030     NG_DO_PATCH(raw_copy_from_user, NG2copy_from_user)
0031     NG_DO_PATCH(raw_copy_to_user, NG2copy_to_user)
0032     retl
0033      nop
0034     .size   niagara2_patch_copyops,.-niagara2_patch_copyops