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

TOMOYO Linux Cross Reference
Linux/arch/arm/boot/compressed/string.c

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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/arm/boot/compressed/string.c (Architecture ppc) and /arch/i386/boot/compressed/string.c (Architecture i386)


  1 // SPDX-License-Identifier: GPL-2.0                 1 
  2 /*                                                
  3  * arch/arm/boot/compressed/string.c              
  4  *                                                
  5  * Small subset of simple string routines         
  6  */                                               
  7                                                   
  8 #define __NO_FORTIFY                              
  9 #include <linux/string.h>                         
 10                                                   
 11 /*                                                
 12  * The decompressor is built without KASan but    
 13  * rest of the kernel when CONFIG_KASAN is ena    
 14  * to __memcpy() but since we are not linking     
 15  * library in the decompressor, that will lead    
 16  *                                                
 17  * Undefine KASan's versions, define the wrapp    
 18  * the right names so that when e.g. __memcpy(    
 19  * still be linked to this local version of me    
 20  */                                               
 21 #ifdef CONFIG_KASAN                               
 22 #undef memcpy                                     
 23 #undef memmove                                    
 24 #undef memset                                     
 25 void *__memcpy(void *__dest, __const void *__s    
 26 void *__memmove(void *__dest, __const void *__    
 27 void *__memset(void *s, int c, size_t count) _    
 28 #endif                                            
 29                                                   
 30 void *memcpy(void *__dest, __const void *__src    
 31 {                                                 
 32         int i = 0;                                
 33         unsigned char *d = (unsigned char *)__    
 34                                                   
 35         for (i = __n >> 3; i > 0; i--) {          
 36                 *d++ = *s++;                      
 37                 *d++ = *s++;                      
 38                 *d++ = *s++;                      
 39                 *d++ = *s++;                      
 40                 *d++ = *s++;                      
 41                 *d++ = *s++;                      
 42                 *d++ = *s++;                      
 43                 *d++ = *s++;                      
 44         }                                         
 45                                                   
 46         if (__n & 1 << 2) {                       
 47                 *d++ = *s++;                      
 48                 *d++ = *s++;                      
 49                 *d++ = *s++;                      
 50                 *d++ = *s++;                      
 51         }                                         
 52                                                   
 53         if (__n & 1 << 1) {                       
 54                 *d++ = *s++;                      
 55                 *d++ = *s++;                      
 56         }                                         
 57                                                   
 58         if (__n & 1)                              
 59                 *d++ = *s++;                      
 60                                                   
 61         return __dest;                            
 62 }                                                 
 63                                                   
 64 void *memmove(void *__dest, __const void *__sr    
 65 {                                                 
 66         unsigned char *d = __dest;                
 67         const unsigned char *s = __src;           
 68                                                   
 69         if (__dest == __src)                      
 70                 return __dest;                    
 71                                                   
 72         if (__dest < __src)                       
 73                 return memcpy(__dest, __src, c    
 74                                                   
 75         while (count--)                           
 76                 d[count] = s[count];              
 77         return __dest;                            
 78 }                                                 
 79                                                   
 80 size_t strlen(const char *s)                      
 81 {                                                 
 82         const char *sc = s;                       
 83                                                   
 84         while (*sc != '\0')                       
 85                 sc++;                             
 86         return sc - s;                            
 87 }                                                 
 88                                                   
 89 size_t strnlen(const char *s, size_t count)       
 90 {                                                 
 91         const char *sc;                           
 92                                                   
 93         for (sc = s; count-- && *sc != '\0'; +    
 94                 /* nothing */;                    
 95         return sc - s;                            
 96 }                                                 
 97                                                   
 98 int memcmp(const void *cs, const void *ct, siz    
 99 {                                                 
100         const unsigned char *su1 = cs, *su2 =     
101         int res = 0;                              
102                                                   
103         while (su1 < end) {                       
104                 res = *su1++ - *su2++;            
105                 if (res)                          
106                         break;                    
107         }                                         
108         return res;                               
109 }                                                 
110                                                   
111 int strcmp(const char *cs, const char *ct)        
112 {                                                 
113         unsigned char c1, c2;                     
114         int res = 0;                              
115                                                   
116         do {                                      
117                 c1 = *cs++;                       
118                 c2 = *ct++;                       
119                 res = c1 - c2;                    
120                 if (res)                          
121                         break;                    
122         } while (c1);                             
123         return res;                               
124 }                                                 
125                                                   
126 void *memchr(const void *s, int c, size_t coun    
127 {                                                 
128         const unsigned char *p = s;               
129                                                   
130         while (count--)                           
131                 if ((unsigned char)c == *p++)     
132                         return (void *)(p - 1)    
133         return NULL;                              
134 }                                                 
135                                                   
136 char *strchr(const char *s, int c)                
137 {                                                 
138         while (*s != (char)c)                     
139                 if (*s++ == '\0')                 
140                         return NULL;              
141         return (char *)s;                         
142 }                                                 
143                                                   
144 char *strrchr(const char *s, int c)               
145 {                                                 
146         const char *last = NULL;                  
147         do {                                      
148                 if (*s == (char)c)                
149                         last = s;                 
150         } while (*s++);                           
151         return (char *)last;                      
152 }                                                 
153                                                   
154 #undef memset                                     
155                                                   
156 void *memset(void *s, int c, size_t count)        
157 {                                                 
158         char *xs = s;                             
159         while (count--)                           
160                 *xs++ = c;                        
161         return s;                                 
162 }                                                 
163                                                   

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