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

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

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/sparc/lib/NGbzero.S (Version linux-6.11-rc3) and /arch/sparc/lib/NGbzero.S (Version linux-4.4.302)


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