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

TOMOYO Linux Cross Reference
Linux/arch/arm/mm/pageattr.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/arm/mm/pageattr.c (Version linux-6.12-rc7) and /arch/ppc/mm/pageattr.c (Version linux-4.18.20)


  1 // SPDX-License-Identifier: GPL-2.0-only            1 
  2 /*                                                
  3  * Copyright (c) 2014, The Linux Foundation. A    
  4  */                                               
  5 #include <linux/mm.h>                             
  6 #include <linux/module.h>                         
  7                                                   
  8 #include <asm/tlbflush.h>                         
  9 #include <asm/set_memory.h>                       
 10                                                   
 11 struct page_change_data {                         
 12         pgprot_t set_mask;                        
 13         pgprot_t clear_mask;                      
 14 };                                                
 15                                                   
 16 static int change_page_range(pte_t *ptep, unsi    
 17 {                                                 
 18         struct page_change_data *cdata = data;    
 19         pte_t pte = *ptep;                        
 20                                                   
 21         pte = clear_pte_bit(pte, cdata->clear_    
 22         pte = set_pte_bit(pte, cdata->set_mask    
 23                                                   
 24         set_pte_ext(ptep, pte, 0);                
 25         return 0;                                 
 26 }                                                 
 27                                                   
 28 static bool range_in_range(unsigned long start    
 29         unsigned long range_start, unsigned lo    
 30 {                                                 
 31         return start >= range_start && start <    
 32                 size <= range_end - start;        
 33 }                                                 
 34                                                   
 35 /*                                                
 36  * This function assumes that the range is map    
 37  */                                               
 38 static int __change_memory_common(unsigned lon    
 39                                 pgprot_t set_m    
 40 {                                                 
 41         struct page_change_data data;             
 42         int ret;                                  
 43                                                   
 44         data.set_mask = set_mask;                 
 45         data.clear_mask = clear_mask;             
 46                                                   
 47         ret = apply_to_page_range(&init_mm, st    
 48                                   &data);         
 49                                                   
 50         flush_tlb_kernel_range(start, start +     
 51         return ret;                               
 52 }                                                 
 53                                                   
 54 static int change_memory_common(unsigned long     
 55                                 pgprot_t set_m    
 56 {                                                 
 57         unsigned long start = addr & PAGE_MASK    
 58         unsigned long end = PAGE_ALIGN(addr) +    
 59         unsigned long size = end - start;         
 60                                                   
 61         WARN_ON_ONCE(start != addr);              
 62                                                   
 63         if (!size)                                
 64                 return 0;                         
 65                                                   
 66         if (!range_in_range(start, size, MODUL    
 67             !range_in_range(start, size, VMALL    
 68                 return -EINVAL;                   
 69                                                   
 70         return __change_memory_common(start, s    
 71 }                                                 
 72                                                   
 73 int set_memory_ro(unsigned long addr, int nump    
 74 {                                                 
 75         return change_memory_common(addr, nump    
 76                                         __pgpr    
 77                                         __pgpr    
 78 }                                                 
 79                                                   
 80 int set_memory_rw(unsigned long addr, int nump    
 81 {                                                 
 82         return change_memory_common(addr, nump    
 83                                         __pgpr    
 84                                         __pgpr    
 85 }                                                 
 86                                                   
 87 int set_memory_nx(unsigned long addr, int nump    
 88 {                                                 
 89         return change_memory_common(addr, nump    
 90                                         __pgpr    
 91                                         __pgpr    
 92 }                                                 
 93                                                   
 94 int set_memory_x(unsigned long addr, int numpa    
 95 {                                                 
 96         return change_memory_common(addr, nump    
 97                                         __pgpr    
 98                                         __pgpr    
 99 }                                                 
100                                                   
101 int set_memory_valid(unsigned long addr, int n    
102 {                                                 
103         if (enable)                               
104                 return __change_memory_common(    
105                                                   
106                                                   
107         else                                      
108                 return __change_memory_common(    
109                                                   
110                                                   
111 }                                                 
112                                                   

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