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

TOMOYO Linux Cross Reference
Linux/arch/microblaze/lib/memcpy.c

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/microblaze/lib/memcpy.c (Version linux-6.11-rc3) and /arch/ppc/lib/memcpy.c (Version linux-6.7.12)


  1 /*                                                  1 
  2  * Copyright (C) 2008-2009 Michal Simek <monst    
  3  * Copyright (C) 2008-2009 PetaLogix              
  4  * Copyright (C) 2007 John Williams               
  5  *                                                
  6  * Reasonably optimised generic C-code for mem    
  7  * This is generic C code to do efficient, ali    
  8  *                                                
  9  * It is based on demo code originally Copyrig    
 10  * http://www.embedded.com/showArticle.jhtml?a    
 11  *                                                
 12  * Attempts were made, unsuccessfully, to cont    
 13  * author of this code (Michael Morrow, Intel)    
 14  * copyright notice.                              
 15  *                                                
 16  * This software has been developed by Intel C    
 17  * Intel specifically disclaims all warranties    
 18  * implied, and all liability, including conse    
 19  * other indirect damages, for the use of this    
 20  * liability for infringement of any proprieta    
 21  * and including the warranties of merchantabi    
 22  * for a particular purpose. Intel does not as    
 23  * responsibility for and errors which may app    
 24  * not any responsibility to update it.           
 25  */                                               
 26                                                   
 27 #include <linux/export.h>                         
 28 #include <linux/types.h>                          
 29 #include <linux/stddef.h>                         
 30 #include <linux/compiler.h>                       
 31                                                   
 32 #include <linux/string.h>                         
 33                                                   
 34 #ifdef CONFIG_OPT_LIB_FUNCTION                    
 35 void *memcpy(void *v_dst, const void *v_src, _    
 36 {                                                 
 37         const char *src = v_src;                  
 38         char *dst = v_dst;                        
 39                                                   
 40         /* The following code tries to optimiz    
 41          * alignment. This will work fine if b    
 42          * aligned on the same boundary. Howev    
 43          * different boundaries shifts will be    
 44          * bad performance on MicroBlaze syste    
 45          */                                       
 46         const uint32_t *i_src;                    
 47         uint32_t *i_dst;                          
 48                                                   
 49         if (likely(c >= 4)) {                     
 50                 unsigned  value, buf_hold;        
 51                                                   
 52                 /* Align the destination to a     
 53                 /* This is done in an endian i    
 54                 switch ((unsigned long)dst & 3    
 55                 case 1:                           
 56                         *dst++ = *src++;          
 57                         --c;                      
 58                         fallthrough;              
 59                 case 2:                           
 60                         *dst++ = *src++;          
 61                         --c;                      
 62                         fallthrough;              
 63                 case 3:                           
 64                         *dst++ = *src++;          
 65                         --c;                      
 66                 }                                 
 67                                                   
 68                 i_dst = (void *)dst;              
 69                                                   
 70                 /* Choose a copy scheme based     
 71                 /* alignment relative to desti    
 72                 switch ((unsigned long)src & 3    
 73                 case 0x0:       /* Both byte o    
 74                         i_src  = (const void *    
 75                                                   
 76                         for (; c >= 4; c -= 4)    
 77                                 *i_dst++ = *i_    
 78                                                   
 79                         src  = (const void *)i    
 80                         break;                    
 81                 case 0x1:       /* Unaligned -    
 82                         /* Word align the sour    
 83                         i_src = (const void *)    
 84 #ifndef __MICROBLAZEEL__                          
 85                         /* Load the holding bu    
 86                         buf_hold = *i_src++ <<    
 87                                                   
 88                         for (; c >= 4; c -= 4)    
 89                                 value = *i_src    
 90                                 *i_dst++ = buf    
 91                                 buf_hold = val    
 92                         }                         
 93 #else                                             
 94                         /* Load the holding bu    
 95                         buf_hold = (*i_src++ &    
 96                                                   
 97                         for (; c >= 4; c -= 4)    
 98                                 value = *i_src    
 99                                 *i_dst++ = buf    
100                                 buf_hold = (va    
101                         }                         
102 #endif                                            
103                         /* Realign the source     
104                         src = (const void *)i_    
105                         src -= 3;                 
106                         break;                    
107                 case 0x2:       /* Unaligned -    
108                         /* Word align the sour    
109                         i_src = (const void *)    
110 #ifndef __MICROBLAZEEL__                          
111                         /* Load the holding bu    
112                         buf_hold = *i_src++ <<    
113                                                   
114                         for (; c >= 4; c -= 4)    
115                                 value = *i_src    
116                                 *i_dst++ = buf    
117                                 buf_hold = val    
118                         }                         
119 #else                                             
120                         /* Load the holding bu    
121                         buf_hold = (*i_src++ &    
122                                                   
123                         for (; c >= 4; c -= 4)    
124                                 value = *i_src    
125                                 *i_dst++ = buf    
126                                 buf_hold = (va    
127                         }                         
128 #endif                                            
129                         /* Realign the source     
130                         src = (const void *)i_    
131                         src -= 2;                 
132                         break;                    
133                 case 0x3:       /* Unaligned -    
134                         /* Word align the sour    
135                         i_src = (const void *)    
136 #ifndef __MICROBLAZEEL__                          
137                         /* Load the holding bu    
138                         buf_hold = *i_src++ <<    
139                                                   
140                         for (; c >= 4; c -= 4)    
141                                 value = *i_src    
142                                 *i_dst++ = buf    
143                                 buf_hold = val    
144                         }                         
145 #else                                             
146                         /* Load the holding bu    
147                         buf_hold = (*i_src++ &    
148                                                   
149                         for (; c >= 4; c -= 4)    
150                                 value = *i_src    
151                                 *i_dst++ = buf    
152                                 buf_hold = (va    
153                         }                         
154 #endif                                            
155                         /* Realign the source     
156                         src = (const void *)i_    
157                         src -= 1;                 
158                         break;                    
159                 }                                 
160                 dst = (void *)i_dst;              
161         }                                         
162                                                   
163         /* Finish off any remaining bytes */      
164         /* simple fast copy, ... unless a cach    
165         switch (c) {                              
166         case 3:                                   
167                 *dst++ = *src++;                  
168                 fallthrough;                      
169         case 2:                                   
170                 *dst++ = *src++;                  
171                 fallthrough;                      
172         case 1:                                   
173                 *dst++ = *src++;                  
174         }                                         
175                                                   
176         return v_dst;                             
177 }                                                 
178 EXPORT_SYMBOL(memcpy);                            
179 #endif /* CONFIG_OPT_LIB_FUNCTION */              
180                                                   

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