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

TOMOYO Linux Cross Reference
Linux/arch/x86/boot/compressed/string.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/x86/boot/compressed/string.c (Architecture ppc) and /arch/mips/boot/compressed/string.c (Architecture mips)


  1 // SPDX-License-Identifier: GPL-2.0                 1 // SPDX-License-Identifier: GPL-2.0
  2 /*                                                  2 /*
  3  * This provides an optimized implementation o !!   3  * arch/mips/boot/compressed/string.c
  4  * implementation of memset and memmove. These !!   4  *
  5  * standard kernel runtime versions are not ye !!   5  * Very small subset of simple string routines
  6  * trust the gcc built-in implementations as t << 
  7  * (e.g. FPU ops) in the minimal decompression << 
  8  */                                                 6  */
  9 #include "error.h"                             << 
 10                                                     7 
 11 #include "../string.c"                         !!   8 #include <linux/compiler_attributes.h>
                                                   >>   9 #include <linux/types.h>
                                                   >>  10 #include <asm/string.h>
 12                                                    11 
 13 #ifdef CONFIG_X86_32                           !!  12 void *memcpy(void *dest, const void *src, size_t n)
 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 {                                                  13 {
 30         long d0, d1, d2;                       !!  14         int i;
 31         asm volatile(                          !!  15         const char *s = src;
 32                 "rep ; movsq\n\t"              !!  16         char *d = dest;
 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                                                    17 
                                                   >>  18         for (i = 0; i < n; i++)
                                                   >>  19                 d[i] = s[i];
 39         return dest;                               20         return dest;
 40 }                                                  21 }
 41 #endif                                         << 
 42                                                    22 
 43 void *memset(void *s, int c, size_t n)             23 void *memset(void *s, int c, size_t n)
 44 {                                                  24 {
 45         int i;                                     25         int i;
 46         char *ss = s;                              26         char *ss = s;
 47                                                    27 
 48         for (i = 0; i < n; i++)                    28         for (i = 0; i < n; i++)
 49                 ss[i] = c;                         29                 ss[i] = c;
 50         return s;                                  30         return s;
 51 }                                                  31 }
 52                                                    32 
 53 void *memmove(void *dest, const void *src, siz !!  33 void * __weak memmove(void *dest, const void *src, size_t n)
 54 {                                                  34 {
 55         unsigned char *d = dest;               !!  35         unsigned int i;
 56         const unsigned char *s = src;          !!  36         const char *s = src;
 57                                                !!  37         char *d = dest;
 58         if (d <= s || d - s >= n)              !!  38 
 59                 return ____memcpy(dest, src, n !!  39         if ((uintptr_t)dest < (uintptr_t)src) {
 60                                                !!  40                 for (i = 0; i < n; i++)
 61         while (n-- > 0)                        !!  41                         d[i] = s[i];
 62                 d[n] = s[n];                   !!  42         } else {
 63                                                !!  43                 for (i = n; i > 0; i--)
 64         return dest;                           !!  44                         d[i - 1] = s[i - 1];
 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         }                                          45         }
 74         return ____memcpy(dest, src, n);       !!  46         return dest;
 75 }                                                  47 }
 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                                                    48 

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