~ [ 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 (Architecture sparc) and /arch/sparc64/lib/NGbzero.S (Architecture sparc64)


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

~ [ 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