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

TOMOYO Linux Cross Reference
Linux/arch/sparc/lib/GENbzero.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/GENbzero.S (Version linux-6.12-rc7) and /arch/sparc/lib/GENbzero.S (Version linux-4.4.302)


  1 /* SPDX-License-Identifier: GPL-2.0 */         << 
  2 /* GENbzero.S: Generic sparc64 memset/clear_us      1 /* GENbzero.S: Generic sparc64 memset/clear_user.
  3  *                                                  2  *
  4  * Copyright (C) 2007 David S. Miller (davem@d      3  * Copyright (C) 2007 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         .align  32                                 15         .align  32
 17         .text                                      16         .text
 18                                                    17 
 19         .globl          GENmemset                  18         .globl          GENmemset
 20         .type           GENmemset, #function       19         .type           GENmemset, #function
 21 GENmemset:              /* %o0=buf, %o1=pat, %     20 GENmemset:              /* %o0=buf, %o1=pat, %o2=len */
 22         and             %o1, 0xff, %o3             21         and             %o1, 0xff, %o3
 23         mov             %o2, %o1                   22         mov             %o2, %o1
 24         sllx            %o3, 8, %g1                23         sllx            %o3, 8, %g1
 25         or              %g1, %o3, %o2              24         or              %g1, %o3, %o2
 26         sllx            %o2, 16, %g1               25         sllx            %o2, 16, %g1
 27         or              %g1, %o2, %o2              26         or              %g1, %o2, %o2
 28         sllx            %o2, 32, %g1               27         sllx            %o2, 32, %g1
 29         ba,pt           %xcc, 1f                   28         ba,pt           %xcc, 1f
 30          or             %g1, %o2, %o2              29          or             %g1, %o2, %o2
 31                                                    30 
 32         .globl          GENbzero                   31         .globl          GENbzero
 33         .type           GENbzero, #function        32         .type           GENbzero, #function
 34 GENbzero:                                          33 GENbzero:
 35         clr             %o2                        34         clr             %o2
 36 1:      brz,pn          %o1, GENbzero_return       35 1:      brz,pn          %o1, GENbzero_return
 37          mov            %o0, %o3                   36          mov            %o0, %o3
 38                                                    37 
 39         /* %o5: saved %asi, restored at GENbze     38         /* %o5: saved %asi, restored at GENbzero_done
 40          * %o4: store %asi to use                  39          * %o4: store %asi to use
 41          */                                        40          */
 42         rd              %asi, %o5                  41         rd              %asi, %o5
 43         mov             ASI_P, %o4                 42         mov             ASI_P, %o4
 44         wr              %o4, 0x0, %asi             43         wr              %o4, 0x0, %asi
 45                                                    44 
 46 GENbzero_from_clear_user:                          45 GENbzero_from_clear_user:
 47         cmp             %o1, 15                    46         cmp             %o1, 15
 48         bl,pn           %icc, GENbzero_tiny        47         bl,pn           %icc, GENbzero_tiny
 49          andcc          %o0, 0x7, %g1              48          andcc          %o0, 0x7, %g1
 50         be,pt           %xcc, 2f                   49         be,pt           %xcc, 2f
 51          mov            8, %g2                     50          mov            8, %g2
 52         sub             %g2, %g1, %g1              51         sub             %g2, %g1, %g1
 53         sub             %o1, %g1, %o1              52         sub             %o1, %g1, %o1
 54 1:      EX_ST(stba %o2, [%o0 + 0x00] %asi)         53 1:      EX_ST(stba %o2, [%o0 + 0x00] %asi)
 55         subcc           %g1, 1, %g1                54         subcc           %g1, 1, %g1
 56         bne,pt          %xcc, 1b                   55         bne,pt          %xcc, 1b
 57          add            %o0, 1, %o0                56          add            %o0, 1, %o0
 58 2:      cmp             %o1, 128                   57 2:      cmp             %o1, 128
 59         bl,pn           %icc, GENbzero_medium      58         bl,pn           %icc, GENbzero_medium
 60          andcc          %o0, (64 - 1), %g1         59          andcc          %o0, (64 - 1), %g1
 61         be,pt           %xcc, GENbzero_pre_loo     60         be,pt           %xcc, GENbzero_pre_loop
 62          mov            64, %g2                    61          mov            64, %g2
 63         sub             %g2, %g1, %g1              62         sub             %g2, %g1, %g1
 64         sub             %o1, %g1, %o1              63         sub             %o1, %g1, %o1
 65 1:      EX_ST(stxa %o2, [%o0 + 0x00] %asi)         64 1:      EX_ST(stxa %o2, [%o0 + 0x00] %asi)
 66         subcc           %g1, 8, %g1                65         subcc           %g1, 8, %g1
 67         bne,pt          %xcc, 1b                   66         bne,pt          %xcc, 1b
 68          add            %o0, 8, %o0                67          add            %o0, 8, %o0
 69                                                    68 
 70 GENbzero_pre_loop:                                 69 GENbzero_pre_loop:
 71         andn            %o1, (64 - 1), %g1         70         andn            %o1, (64 - 1), %g1
 72         sub             %o1, %g1, %o1              71         sub             %o1, %g1, %o1
 73 GENbzero_loop:                                     72 GENbzero_loop:
 74         EX_ST(stxa %o2, [%o0 + 0x00] %asi)         73         EX_ST(stxa %o2, [%o0 + 0x00] %asi)
 75         EX_ST(stxa %o2, [%o0 + 0x08] %asi)         74         EX_ST(stxa %o2, [%o0 + 0x08] %asi)
 76         EX_ST(stxa %o2, [%o0 + 0x10] %asi)         75         EX_ST(stxa %o2, [%o0 + 0x10] %asi)
 77         EX_ST(stxa %o2, [%o0 + 0x18] %asi)         76         EX_ST(stxa %o2, [%o0 + 0x18] %asi)
 78         EX_ST(stxa %o2, [%o0 + 0x20] %asi)         77         EX_ST(stxa %o2, [%o0 + 0x20] %asi)
 79         EX_ST(stxa %o2, [%o0 + 0x28] %asi)         78         EX_ST(stxa %o2, [%o0 + 0x28] %asi)
 80         EX_ST(stxa %o2, [%o0 + 0x30] %asi)         79         EX_ST(stxa %o2, [%o0 + 0x30] %asi)
 81         EX_ST(stxa %o2, [%o0 + 0x38] %asi)         80         EX_ST(stxa %o2, [%o0 + 0x38] %asi)
 82         subcc           %g1, 64, %g1               81         subcc           %g1, 64, %g1
 83         bne,pt          %xcc, GENbzero_loop        82         bne,pt          %xcc, GENbzero_loop
 84          add            %o0, 64, %o0               83          add            %o0, 64, %o0
 85                                                    84 
 86         membar          #Sync                      85         membar          #Sync
 87         wr              %o4, 0x0, %asi             86         wr              %o4, 0x0, %asi
 88         brz,pn          %o1, GENbzero_done         87         brz,pn          %o1, GENbzero_done
 89 GENbzero_medium:                                   88 GENbzero_medium:
 90          andncc         %o1, 0x7, %g1              89          andncc         %o1, 0x7, %g1
 91         be,pn           %xcc, 2f                   90         be,pn           %xcc, 2f
 92          sub            %o1, %g1, %o1              91          sub            %o1, %g1, %o1
 93 1:      EX_ST(stxa %o2, [%o0 + 0x00] %asi)         92 1:      EX_ST(stxa %o2, [%o0 + 0x00] %asi)
 94         subcc           %g1, 8, %g1                93         subcc           %g1, 8, %g1
 95         bne,pt          %xcc, 1b                   94         bne,pt          %xcc, 1b
 96          add            %o0, 8, %o0                95          add            %o0, 8, %o0
 97 2:      brz,pt          %o1, GENbzero_done         96 2:      brz,pt          %o1, GENbzero_done
 98          nop                                       97          nop
 99                                                    98 
100 GENbzero_tiny:                                     99 GENbzero_tiny:
101 1:      EX_ST(stba %o2, [%o0 + 0x00] %asi)        100 1:      EX_ST(stba %o2, [%o0 + 0x00] %asi)
102         subcc           %o1, 1, %o1               101         subcc           %o1, 1, %o1
103         bne,pt          %icc, 1b                  102         bne,pt          %icc, 1b
104          add            %o0, 1, %o0               103          add            %o0, 1, %o0
105                                                   104 
106         /* fallthrough */                         105         /* fallthrough */
107                                                   106 
108 GENbzero_done:                                    107 GENbzero_done:
109         wr              %o5, 0x0, %asi            108         wr              %o5, 0x0, %asi
110                                                   109 
111 GENbzero_return:                                  110 GENbzero_return:
112         retl                                      111         retl
113          mov            %o3, %o0                  112          mov            %o3, %o0
114         .size           GENbzero, .-GENbzero      113         .size           GENbzero, .-GENbzero
115         .size           GENmemset, .-GENmemset    114         .size           GENmemset, .-GENmemset
116                                                   115 
117         .globl          GENclear_user             116         .globl          GENclear_user
118         .type           GENclear_user, #functi    117         .type           GENclear_user, #function
119 GENclear_user:          /* %o0=buf, %o1=len */    118 GENclear_user:          /* %o0=buf, %o1=len */
120         rd              %asi, %o5                 119         rd              %asi, %o5
121         brz,pn          %o1, GENbzero_done        120         brz,pn          %o1, GENbzero_done
122          clr            %o3                       121          clr            %o3
123         cmp             %o5, ASI_AIUS             122         cmp             %o5, ASI_AIUS
124         bne,pn          %icc, GENbzero            123         bne,pn          %icc, GENbzero
125          clr            %o2                       124          clr            %o2
126         ba,pt           %xcc, GENbzero_from_cl    125         ba,pt           %xcc, GENbzero_from_clear_user
127          mov            ASI_AIUS, %o4             126          mov            ASI_AIUS, %o4
128         .size           GENclear_user, .-GENcl    127         .size           GENclear_user, .-GENclear_user
129                                                   128 
130 #define BRANCH_ALWAYS   0x10680000                129 #define BRANCH_ALWAYS   0x10680000
131 #define NOP             0x01000000                130 #define NOP             0x01000000
132 #define GEN_DO_PATCH(OLD, NEW)  \                 131 #define GEN_DO_PATCH(OLD, NEW)  \
133         sethi   %hi(NEW), %g1; \                  132         sethi   %hi(NEW), %g1; \
134         or      %g1, %lo(NEW), %g1; \             133         or      %g1, %lo(NEW), %g1; \
135         sethi   %hi(OLD), %g2; \                  134         sethi   %hi(OLD), %g2; \
136         or      %g2, %lo(OLD), %g2; \             135         or      %g2, %lo(OLD), %g2; \
137         sub     %g1, %g2, %g1; \                  136         sub     %g1, %g2, %g1; \
138         sethi   %hi(BRANCH_ALWAYS), %g3; \        137         sethi   %hi(BRANCH_ALWAYS), %g3; \
139         sll     %g1, 11, %g1; \                   138         sll     %g1, 11, %g1; \
140         srl     %g1, 11 + 2, %g1; \               139         srl     %g1, 11 + 2, %g1; \
141         or      %g3, %lo(BRANCH_ALWAYS), %g3;     140         or      %g3, %lo(BRANCH_ALWAYS), %g3; \
142         or      %g3, %g1, %g3; \                  141         or      %g3, %g1, %g3; \
143         stw     %g3, [%g2]; \                     142         stw     %g3, [%g2]; \
144         sethi   %hi(NOP), %g3; \                  143         sethi   %hi(NOP), %g3; \
145         or      %g3, %lo(NOP), %g3; \             144         or      %g3, %lo(NOP), %g3; \
146         stw     %g3, [%g2 + 0x4]; \               145         stw     %g3, [%g2 + 0x4]; \
147         flush   %g2;                              146         flush   %g2;
148                                                   147 
149         .globl  generic_patch_bzero               148         .globl  generic_patch_bzero
150         .type   generic_patch_bzero,#function     149         .type   generic_patch_bzero,#function
151 generic_patch_bzero:                              150 generic_patch_bzero:
152         GEN_DO_PATCH(memset, GENmemset)           151         GEN_DO_PATCH(memset, GENmemset)
153         GEN_DO_PATCH(__bzero, GENbzero)           152         GEN_DO_PATCH(__bzero, GENbzero)
154         GEN_DO_PATCH(__clear_user, GENclear_us    153         GEN_DO_PATCH(__clear_user, GENclear_user)
155         retl                                      154         retl
156          nop                                      155          nop
157         .size   generic_patch_bzero,.-generic_    156         .size   generic_patch_bzero,.-generic_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