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

TOMOYO Linux Cross Reference
Linux/arch/csky/kernel/module.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/csky/kernel/module.c (Version linux-6.12-rc7) and /arch/ppc/kernel/module.c (Version linux-5.5.19)


  1 // SPDX-License-Identifier: GPL-2.0                 1 
  2 // Copyright (C) 2018 Hangzhou C-SKY Microsyst    
  3                                                   
  4 #include <linux/moduleloader.h>                   
  5 #include <linux/elf.h>                            
  6 #include <linux/mm.h>                             
  7 #include <linux/vmalloc.h>                        
  8 #include <linux/slab.h>                           
  9 #include <linux/fs.h>                             
 10 #include <linux/string.h>                         
 11 #include <linux/kernel.h>                         
 12 #include <linux/spinlock.h>                       
 13                                                   
 14 #ifdef CONFIG_CPU_CK810                           
 15 #define IS_BSR32(hi16, lo16)            (((hi1    
 16 #define IS_JSRI32(hi16, lo16)           ((hi16    
 17                                                   
 18 #define CHANGE_JSRI_TO_LRW(addr) do {             
 19         *(uint16_t *)(addr) = (*(uint16_t *)(a    
 20         *((uint16_t *)(addr) + 1) = *((uint16_    
 21 } while (0)                                       
 22                                                   
 23 #define SET_JSR32_R26(addr) do {                  
 24         *(uint16_t *)(addr) = 0xE8Fa;             
 25         *((uint16_t *)(addr) + 1) = 0x0000;       
 26 } while (0)                                       
 27                                                   
 28 static void jsri_2_lrw_jsr(uint32_t *location)    
 29 {                                                 
 30         uint16_t *location_tmp = (uint16_t *)l    
 31                                                   
 32         if (IS_BSR32(*location_tmp, *(location    
 33                 return;                           
 34                                                   
 35         if (IS_JSRI32(*location_tmp, *(locatio    
 36                 /* jsri 0x...  --> lrw r26, 0x    
 37                 CHANGE_JSRI_TO_LRW(location);     
 38                 /* lsli r0, r0 --> jsr r26 */     
 39                 SET_JSR32_R26(location + 1);      
 40         }                                         
 41 }                                                 
 42 #else                                             
 43 static inline void jsri_2_lrw_jsr(uint32_t *lo    
 44 {                                                 
 45         return;                                   
 46 }                                                 
 47 #endif                                            
 48                                                   
 49 int apply_relocate_add(Elf32_Shdr *sechdrs, co    
 50                 unsigned int symindex, unsigne    
 51 {                                                 
 52         unsigned int i;                           
 53         Elf32_Rela      *rel = (void *) sechdr    
 54         Elf32_Sym       *sym;                     
 55         uint32_t        *location;                
 56         short           *temp;                    
 57                                                   
 58         for (i = 0; i < sechdrs[relsec].sh_siz    
 59                 /* This is where to make the c    
 60                 location = (void *)sechdrs[sec    
 61                                                   
 62                 sym = (Elf32_Sym *)sechdrs[sym    
 63                                                   
 64                                                   
 65                 switch (ELF32_R_TYPE(rel[i].r_    
 66                 case R_CSKY_32:                   
 67                         /* We add the value in    
 68                         *location = rel[i].r_a    
 69                         break;                    
 70                 case R_CSKY_PC32:                 
 71                         /* Add the value, subt    
 72                         *location = rel[i].r_a    
 73                                                   
 74                         break;                    
 75                 case R_CSKY_PCRELJSR_IMM11BY2:    
 76                         break;                    
 77                 case R_CSKY_PCRELJSR_IMM26BY2:    
 78                         jsri_2_lrw_jsr(locatio    
 79                         break;                    
 80                 case R_CSKY_ADDR_HI16:            
 81                         temp = ((short  *)loca    
 82                         *temp = (short)           
 83                                 ((rel[i].r_add    
 84                         break;                    
 85                 case R_CSKY_ADDR_LO16:            
 86                         temp = ((short  *)loca    
 87                         *temp = (short)           
 88                                 ((rel[i].r_add    
 89                         break;                    
 90                 default:                          
 91                         pr_err("module %s: Unk    
 92                                 me->name, ELF3    
 93                         return -ENOEXEC;          
 94                 }                                 
 95         }                                         
 96         return 0;                                 
 97 }                                                 
 98                                                   

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