~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/sparc/lib/NGbzero.S

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/sparc/lib/NGbzero.S (Architecture i386) and /arch/sparc/lib/NGbzero.S (Architecture sparc)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /* NGbzero.S: Niagara optimized memset/clear_u      2 /* NGbzero.S: Niagara optimized memset/clear_user.
  3  *                                                  3  *
  4  * Copyright (C) 2006 David S. Miller (davem@d      4  * Copyright (C) 2006 David S. Miller (davem@davemloft.net)
  5  */                                                 5  */
  6 #include <asm/asi.h>                                6 #include <asm/asi.h>
  7                                                     7 
  8 #define EX_ST(x,y)              \                   8 #define EX_ST(x,y)              \
  9 98:     x,y;                    \                   9 98:     x,y;                    \
 10         .section __ex_table,"a";\                  10         .section __ex_table,"a";\
 11         .align 4;               \                  11         .align 4;               \
 12         .word 98b, __retl_o1_asi;\                 12         .word 98b, __retl_o1_asi;\
 13         .text;                  \                  13         .text;                  \
 14         .align 4;                                  14         .align 4;
 15                                                    15 
 16         .text                                      16         .text
 17                                                    17 
 18         .globl          NGmemset                   18         .globl          NGmemset
 19         .type           NGmemset, #function        19         .type           NGmemset, #function
 20 NGmemset:               /* %o0=buf, %o1=pat, %     20 NGmemset:               /* %o0=buf, %o1=pat, %o2=len */
 21         and             %o1, 0xff, %o3             21         and             %o1, 0xff, %o3
 22         mov             %o2, %o1                   22         mov             %o2, %o1
 23         sllx            %o3, 8, %g1                23         sllx            %o3, 8, %g1
 24         or              %g1, %o3, %o2              24         or              %g1, %o3, %o2
 25         sllx            %o2, 16, %g1               25         sllx            %o2, 16, %g1
 26         or              %g1, %o2, %o2              26         or              %g1, %o2, %o2
 27         sllx            %o2, 32, %g1               27         sllx            %o2, 32, %g1
 28         ba,pt           %xcc, 1f                   28         ba,pt           %xcc, 1f
 29          or             %g1, %o2, %o2              29          or             %g1, %o2, %o2
 30                                                    30 
 31         .globl          NGbzero                    31         .globl          NGbzero
 32         .type           NGbzero, #function         32         .type           NGbzero, #function
 33 NGbzero:                                           33 NGbzero:
 34         clr             %o2                        34         clr             %o2
 35 1:      brz,pn          %o1, NGbzero_return        35 1:      brz,pn          %o1, NGbzero_return
 36          mov            %o0, %o3                   36          mov            %o0, %o3
 37                                                    37 
 38         /* %o5: saved %asi, restored at NGbzer     38         /* %o5: saved %asi, restored at NGbzero_done
 39          * %g7: store-init %asi to use             39          * %g7: store-init %asi to use
 40          * %o4: non-store-init %asi to use         40          * %o4: non-store-init %asi to use
 41          */                                        41          */
 42         rd              %asi, %o5                  42         rd              %asi, %o5
 43         mov             ASI_BLK_INIT_QUAD_LDD_     43         mov             ASI_BLK_INIT_QUAD_LDD_P, %g7
 44         mov             ASI_P, %o4                 44         mov             ASI_P, %o4
 45         wr              %o4, 0x0, %asi             45         wr              %o4, 0x0, %asi
 46                                                    46 
 47 NGbzero_from_clear_user:                           47 NGbzero_from_clear_user:
 48         cmp             %o1, 15                    48         cmp             %o1, 15
 49         bl,pn           %icc, NGbzero_tiny         49         bl,pn           %icc, NGbzero_tiny
 50          andcc          %o0, 0x7, %g1              50          andcc          %o0, 0x7, %g1
 51         be,pt           %xcc, 2f                   51         be,pt           %xcc, 2f
 52          mov            8, %g2                     52          mov            8, %g2
 53         sub             %g2, %g1, %g1              53         sub             %g2, %g1, %g1
 54         sub             %o1, %g1, %o1              54         sub             %o1, %g1, %o1
 55 1:      EX_ST(stba %o2, [%o0 + 0x00] %asi)         55 1:      EX_ST(stba %o2, [%o0 + 0x00] %asi)
 56         subcc           %g1, 1, %g1                56         subcc           %g1, 1, %g1
 57         bne,pt          %xcc, 1b                   57         bne,pt          %xcc, 1b
 58          add            %o0, 1, %o0                58          add            %o0, 1, %o0
 59 2:      cmp             %o1, 128                   59 2:      cmp             %o1, 128
 60         bl,pn           %icc, NGbzero_medium       60         bl,pn           %icc, NGbzero_medium
 61          andcc          %o0, (64 - 1), %g1         61          andcc          %o0, (64 - 1), %g1
 62         be,pt           %xcc, NGbzero_pre_loop     62         be,pt           %xcc, NGbzero_pre_loop
 63          mov            64, %g2                    63          mov            64, %g2
 64         sub             %g2, %g1, %g1              64         sub             %g2, %g1, %g1
 65         sub             %o1, %g1, %o1              65         sub             %o1, %g1, %o1
 66 1:      EX_ST(stxa %o2, [%o0 + 0x00] %asi)         66 1:      EX_ST(stxa %o2, [%o0 + 0x00] %asi)
 67         subcc           %g1, 8, %g1                67         subcc           %g1, 8, %g1
 68         bne,pt          %xcc, 1b                   68         bne,pt          %xcc, 1b
 69          add            %o0, 8, %o0                69          add            %o0, 8, %o0
 70                                                    70 
 71 NGbzero_pre_loop:                                  71 NGbzero_pre_loop:
 72         wr              %g7, 0x0, %asi             72         wr              %g7, 0x0, %asi
 73         andn            %o1, (64 - 1), %g1         73         andn            %o1, (64 - 1), %g1
 74         sub             %o1, %g1, %o1              74         sub             %o1, %g1, %o1
 75 NGbzero_loop:                                      75 NGbzero_loop:
 76         EX_ST(stxa %o2, [%o0 + 0x00] %asi)         76         EX_ST(stxa %o2, [%o0 + 0x00] %asi)
 77         EX_ST(stxa %o2, [%o0 + 0x08] %asi)         77         EX_ST(stxa %o2, [%o0 + 0x08] %asi)
 78         EX_ST(stxa %o2, [%o0 + 0x10] %asi)         78         EX_ST(stxa %o2, [%o0 + 0x10] %asi)
 79         EX_ST(stxa %o2, [%o0 + 0x18] %asi)         79         EX_ST(stxa %o2, [%o0 + 0x18] %asi)
 80         EX_ST(stxa %o2, [%o0 + 0x20] %asi)         80         EX_ST(stxa %o2, [%o0 + 0x20] %asi)
 81         EX_ST(stxa %o2, [%o0 + 0x28] %asi)         81         EX_ST(stxa %o2, [%o0 + 0x28] %asi)
 82         EX_ST(stxa %o2, [%o0 + 0x30] %asi)         82         EX_ST(stxa %o2, [%o0 + 0x30] %asi)
 83         EX_ST(stxa %o2, [%o0 + 0x38] %asi)         83         EX_ST(stxa %o2, [%o0 + 0x38] %asi)
 84         subcc           %g1, 64, %g1               84         subcc           %g1, 64, %g1
 85         bne,pt          %xcc, NGbzero_loop         85         bne,pt          %xcc, NGbzero_loop
 86          add            %o0, 64, %o0               86          add            %o0, 64, %o0
 87                                                    87 
 88         membar          #Sync                      88         membar          #Sync
 89         wr              %o4, 0x0, %asi             89         wr              %o4, 0x0, %asi
 90         brz,pn          %o1, NGbzero_done          90         brz,pn          %o1, NGbzero_done
 91 NGbzero_medium:                                    91 NGbzero_medium:
 92          andncc         %o1, 0x7, %g1              92          andncc         %o1, 0x7, %g1
 93         be,pn           %xcc, 2f                   93         be,pn           %xcc, 2f
 94          sub            %o1, %g1, %o1              94          sub            %o1, %g1, %o1
 95 1:      EX_ST(stxa %o2, [%o0 + 0x00] %asi)         95 1:      EX_ST(stxa %o2, [%o0 + 0x00] %asi)
 96         subcc           %g1, 8, %g1                96         subcc           %g1, 8, %g1
 97         bne,pt          %xcc, 1b                   97         bne,pt          %xcc, 1b
 98          add            %o0, 8, %o0                98          add            %o0, 8, %o0
 99 2:      brz,pt          %o1, NGbzero_done          99 2:      brz,pt          %o1, NGbzero_done
100          nop                                      100          nop
101                                                   101 
102 NGbzero_tiny:                                     102 NGbzero_tiny:
103 1:      EX_ST(stba %o2, [%o0 + 0x00] %asi)        103 1:      EX_ST(stba %o2, [%o0 + 0x00] %asi)
104         subcc           %o1, 1, %o1               104         subcc           %o1, 1, %o1
105         bne,pt          %icc, 1b                  105         bne,pt          %icc, 1b
106          add            %o0, 1, %o0               106          add            %o0, 1, %o0
107                                                   107 
108         /* fallthrough */                         108         /* fallthrough */
109                                                   109 
110 NGbzero_done:                                     110 NGbzero_done:
111         wr              %o5, 0x0, %asi            111         wr              %o5, 0x0, %asi
112                                                   112 
113 NGbzero_return:                                   113 NGbzero_return:
114         retl                                      114         retl
115          mov            %o3, %o0                  115          mov            %o3, %o0
116         .size           NGbzero, .-NGbzero        116         .size           NGbzero, .-NGbzero
117         .size           NGmemset, .-NGmemset      117         .size           NGmemset, .-NGmemset
118                                                   118 
119         .globl          NGclear_user              119         .globl          NGclear_user
120         .type           NGclear_user, #functio    120         .type           NGclear_user, #function
121 NGclear_user:           /* %o0=buf, %o1=len */    121 NGclear_user:           /* %o0=buf, %o1=len */
122         rd              %asi, %o5                 122         rd              %asi, %o5
123         brz,pn          %o1, NGbzero_done         123         brz,pn          %o1, NGbzero_done
124          clr            %o3                       124          clr            %o3
125         cmp             %o5, ASI_AIUS             125         cmp             %o5, ASI_AIUS
126         bne,pn          %icc, NGbzero             126         bne,pn          %icc, NGbzero
127          clr            %o2                       127          clr            %o2
128         mov             ASI_BLK_INIT_QUAD_LDD_    128         mov             ASI_BLK_INIT_QUAD_LDD_AIUS, %g7
129         ba,pt           %xcc, NGbzero_from_cle    129         ba,pt           %xcc, NGbzero_from_clear_user
130          mov            ASI_AIUS, %o4             130          mov            ASI_AIUS, %o4
131         .size           NGclear_user, .-NGclea    131         .size           NGclear_user, .-NGclear_user
132                                                   132 
133 #define BRANCH_ALWAYS   0x10680000                133 #define BRANCH_ALWAYS   0x10680000
134 #define NOP             0x01000000                134 #define NOP             0x01000000
135 #define NG_DO_PATCH(OLD, NEW)   \                 135 #define NG_DO_PATCH(OLD, NEW)   \
136         sethi   %hi(NEW), %g1; \                  136         sethi   %hi(NEW), %g1; \
137         or      %g1, %lo(NEW), %g1; \             137         or      %g1, %lo(NEW), %g1; \
138         sethi   %hi(OLD), %g2; \                  138         sethi   %hi(OLD), %g2; \
139         or      %g2, %lo(OLD), %g2; \             139         or      %g2, %lo(OLD), %g2; \
140         sub     %g1, %g2, %g1; \                  140         sub     %g1, %g2, %g1; \
141         sethi   %hi(BRANCH_ALWAYS), %g3; \        141         sethi   %hi(BRANCH_ALWAYS), %g3; \
142         sll     %g1, 11, %g1; \                   142         sll     %g1, 11, %g1; \
143         srl     %g1, 11 + 2, %g1; \               143         srl     %g1, 11 + 2, %g1; \
144         or      %g3, %lo(BRANCH_ALWAYS), %g3;     144         or      %g3, %lo(BRANCH_ALWAYS), %g3; \
145         or      %g3, %g1, %g3; \                  145         or      %g3, %g1, %g3; \
146         stw     %g3, [%g2]; \                     146         stw     %g3, [%g2]; \
147         sethi   %hi(NOP), %g3; \                  147         sethi   %hi(NOP), %g3; \
148         or      %g3, %lo(NOP), %g3; \             148         or      %g3, %lo(NOP), %g3; \
149         stw     %g3, [%g2 + 0x4]; \               149         stw     %g3, [%g2 + 0x4]; \
150         flush   %g2;                              150         flush   %g2;
151                                                   151 
152         .globl  niagara_patch_bzero               152         .globl  niagara_patch_bzero
153         .type   niagara_patch_bzero,#function     153         .type   niagara_patch_bzero,#function
154 niagara_patch_bzero:                              154 niagara_patch_bzero:
155         NG_DO_PATCH(memset, NGmemset)             155         NG_DO_PATCH(memset, NGmemset)
156         NG_DO_PATCH(__bzero, NGbzero)             156         NG_DO_PATCH(__bzero, NGbzero)
157         NG_DO_PATCH(__clear_user, NGclear_user    157         NG_DO_PATCH(__clear_user, NGclear_user)
158         NG_DO_PATCH(tsb_init, NGtsb_init)         158         NG_DO_PATCH(tsb_init, NGtsb_init)
159         retl                                      159         retl
160          nop                                      160          nop
161         .size   niagara_patch_bzero,.-niagara_    161         .size   niagara_patch_bzero,.-niagara_patch_bzero
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php