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

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

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ 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/x86/boot/compressed/string.c (Architecture mips) and /arch/ppc/boot/compressed/string.c (Architecture ppc)


  1 // SPDX-License-Identifier: GPL-2.0                 1 
  2 /*                                                
  3  * This provides an optimized implementation o    
  4  * implementation of memset and memmove. These    
  5  * standard kernel runtime versions are not ye    
  6  * trust the gcc built-in implementations as t    
  7  * (e.g. FPU ops) in the minimal decompression    
  8  */                                               
  9 #include "error.h"                                
 10                                                   
 11 #include "../string.c"                            
 12                                                   
 13 #ifdef CONFIG_X86_32                              
 14 static void *____memcpy(void *dest, const void    
 15 {                                                 
 16         int d0, d1, d2;                           
 17         asm volatile(                             
 18                 "rep ; movsl\n\t"                 
 19                 "movl %4,%%ecx\n\t"               
 20                 "rep ; movsb\n\t"                 
 21                 : "=&c" (d0), "=&D" (d1), "=&S    
 22                 : "" (n >> 2), "g" (n & 3), "1    
 23                 : "memory");                      
 24                                                   
 25         return dest;                              
 26 }                                                 
 27 #else                                             
 28 static void *____memcpy(void *dest, const void    
 29 {                                                 
 30         long d0, d1, d2;                          
 31         asm volatile(                             
 32                 "rep ; movsq\n\t"                 
 33                 "movq %4,%%rcx\n\t"               
 34                 "rep ; movsb\n\t"                 
 35                 : "=&c" (d0), "=&D" (d1), "=&S    
 36                 : "" (n >> 3), "g" (n & 7), "1    
 37                 : "memory");                      
 38                                                   
 39         return dest;                              
 40 }                                                 
 41 #endif                                            
 42                                                   
 43 void *memset(void *s, int c, size_t n)            
 44 {                                                 
 45         int i;                                    
 46         char *ss = s;                             
 47                                                   
 48         for (i = 0; i < n; i++)                   
 49                 ss[i] = c;                        
 50         return s;                                 
 51 }                                                 
 52                                                   
 53 void *memmove(void *dest, const void *src, siz    
 54 {                                                 
 55         unsigned char *d = dest;                  
 56         const unsigned char *s = src;             
 57                                                   
 58         if (d <= s || d - s >= n)                 
 59                 return ____memcpy(dest, src, n    
 60                                                   
 61         while (n-- > 0)                           
 62                 d[n] = s[n];                      
 63                                                   
 64         return dest;                              
 65 }                                                 
 66                                                   
 67 /* Detect and warn about potential overlaps, b    
 68 void *memcpy(void *dest, const void *src, size    
 69 {                                                 
 70         if (dest > src && dest - src < n) {       
 71                 warn("Avoiding potentially uns    
 72                 return memmove(dest, src, n);     
 73         }                                         
 74         return ____memcpy(dest, src, n);          
 75 }                                                 
 76                                                   
 77 #ifdef CONFIG_KASAN                               
 78 extern void *__memset(void *s, int c, size_t n    
 79 extern void *__memmove(void *dest, const void     
 80 extern void *__memcpy(void *dest, const void *    
 81 #endif                                            
 82                                                   

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