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

TOMOYO Linux Cross Reference
Linux/arch/s390/boot/printk.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.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/s390/boot/printk.c (Architecture mips) and /arch/sparc64/boot/printk.c (Architecture sparc64)


  1 // SPDX-License-Identifier: GPL-2.0                 1 
  2 #include <linux/kernel.h>                         
  3 #include <linux/stdarg.h>                         
  4 #include <linux/string.h>                         
  5 #include <linux/ctype.h>                          
  6 #include <asm/stacktrace.h>                       
  7 #include <asm/boot_data.h>                        
  8 #include <asm/lowcore.h>                          
  9 #include <asm/setup.h>                            
 10 #include <asm/sclp.h>                             
 11 #include <asm/uv.h>                               
 12 #include "boot.h"                                 
 13                                                   
 14 const char hex_asc[] = "0123456789abcdef";        
 15                                                   
 16 static char *as_hex(char *dst, unsigned long v    
 17 {                                                 
 18         char *p, *end = p = dst + max(pad, (in    
 19                                                   
 20         for (*p-- = 0; p >= dst; val >>= 4)       
 21                 *p-- = hex_asc[val & 0x0f];       
 22         return end;                               
 23 }                                                 
 24                                                   
 25 static char *symstart(char *p)                    
 26 {                                                 
 27         while (*p)                                
 28                 p--;                              
 29         return p + 1;                             
 30 }                                                 
 31                                                   
 32 static noinline char *findsym(unsigned long ip    
 33 {                                                 
 34         /* symbol entries are in a form "10000    
 35         char *a = _decompressor_syms_start;       
 36         char *b = _decompressor_syms_end;         
 37         unsigned long start;                      
 38         unsigned long size;                       
 39         char *pivot;                              
 40         char *endp;                               
 41                                                   
 42         while (a < b) {                           
 43                 pivot = symstart(a + (b - a) /    
 44                 start = simple_strtoull(pivot,    
 45                 size = simple_strtoull(endp +     
 46                 if (ip < start) {                 
 47                         b = pivot;                
 48                         continue;                 
 49                 }                                 
 50                 if (ip > start + size) {          
 51                         a = pivot + strlen(piv    
 52                         continue;                 
 53                 }                                 
 54                 *off = ip - start;                
 55                 *len = size;                      
 56                 return endp + 1;                  
 57         }                                         
 58         return NULL;                              
 59 }                                                 
 60                                                   
 61 static noinline char *strsym(void *ip)            
 62 {                                                 
 63         static char buf[64];                      
 64         unsigned short off;                       
 65         unsigned short len;                       
 66         char *p;                                  
 67                                                   
 68         p = findsym((unsigned long)ip, &off, &    
 69         if (p) {                                  
 70                 strncpy(buf, p, sizeof(buf));     
 71                 /* reserve 15 bytes for offset    
 72                 p = buf + strnlen(buf, sizeof(    
 73                 strcpy(p, "+0x");                 
 74                 p = as_hex(p + 3, off, 0);        
 75                 strcpy(p, "/0x");                 
 76                 as_hex(p + 3, len, 0);            
 77         } else {                                  
 78                 as_hex(buf, (unsigned long)ip,    
 79         }                                         
 80         return buf;                               
 81 }                                                 
 82                                                   
 83 void boot_printk(const char *fmt, ...)            
 84 {                                                 
 85         char buf[1024] = { 0 };                   
 86         char *end = buf + sizeof(buf) - 1; /*     
 87         unsigned long pad;                        
 88         char *p = buf;                            
 89         va_list args;                             
 90                                                   
 91         va_start(args, fmt);                      
 92         for (; p < end && *fmt; fmt++) {          
 93                 if (*fmt != '%') {                
 94                         *p++ = *fmt;              
 95                         continue;                 
 96                 }                                 
 97                 pad = isdigit(*++fmt) ? simple    
 98                 switch (*fmt) {                   
 99                 case 's':                         
100                         p = buf + strlcat(buf,    
101                         break;                    
102                 case 'p':                         
103                         if (*++fmt != 'S')        
104                                 goto out;         
105                         p = buf + strlcat(buf,    
106                         break;                    
107                 case 'l':                         
108                         if (*++fmt != 'x' || e    
109                                 goto out;         
110                         p = as_hex(p, va_arg(a    
111                         break;                    
112                 case 'x':                         
113                         if (end - p <= max(siz    
114                                 goto out;         
115                         p = as_hex(p, va_arg(a    
116                         break;                    
117                 default:                          
118                         goto out;                 
119                 }                                 
120         }                                         
121 out:                                              
122         va_end(args);                             
123         sclp_early_printk(buf);                   
124 }                                                 
125                                                   

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