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

TOMOYO Linux Cross Reference
Linux/include/asm-ia64/page.h

Version: ~ [ linux-5.15-rc5 ] ~ [ linux-5.14.11 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.72 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.152 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.210 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.250 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.286 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.288 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ 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.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef _ASM_IA64_PAGE_H
  2 #define _ASM_IA64_PAGE_H
  3 /*
  4  * Pagetable related stuff.
  5  *
  6  * Copyright (C) 1998, 1999, 2002 Hewlett-Packard Co
  7  *      David Mosberger-Tang <davidm@hpl.hp.com>
  8  */
  9 
 10 #include <linux/config.h>
 11 
 12 #include <asm/intrinsics.h>
 13 #include <asm/types.h>
 14 
 15 /*
 16  * PAGE_SHIFT determines the actual kernel page size.
 17  */
 18 #if defined(CONFIG_IA64_PAGE_SIZE_4KB)
 19 # define PAGE_SHIFT     12
 20 #elif defined(CONFIG_IA64_PAGE_SIZE_8KB)
 21 # define PAGE_SHIFT     13
 22 #elif defined(CONFIG_IA64_PAGE_SIZE_16KB)
 23 # define PAGE_SHIFT     14
 24 #elif defined(CONFIG_IA64_PAGE_SIZE_64KB)
 25 # define PAGE_SHIFT     16
 26 #else
 27 # error Unsupported page size!
 28 #endif
 29 
 30 #define PAGE_SIZE               (__IA64_UL_CONST(1) << PAGE_SHIFT)
 31 #define PAGE_MASK               (~(PAGE_SIZE - 1))
 32 #define PAGE_ALIGN(addr)        (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
 33 
 34 #define PERCPU_PAGE_SHIFT       16      /* log2() of max. size of per-CPU area */
 35 #define PERCPU_PAGE_SIZE        (__IA64_UL_CONST(1) << PERCPU_PAGE_SHIFT)
 36 
 37 #define RGN_MAP_LIMIT   ((1UL << (4*PAGE_SHIFT - 12)) - PAGE_SIZE)      /* per region addr limit */
 38 
 39 #ifdef CONFIG_HUGETLB_PAGE
 40 
 41 # if defined(CONFIG_HUGETLB_PAGE_SIZE_4GB)
 42 #  define HPAGE_SHIFT   32
 43 # elif defined(CONFIG_HUGETLB_PAGE_SIZE_1GB)
 44 #  define HPAGE_SHIFT   30
 45 # elif defined(CONFIG_HUGETLB_PAGE_SIZE_256MB)
 46 #  define HPAGE_SHIFT   28
 47 # elif defined(CONFIG_HUGETLB_PAGE_SIZE_64MB)
 48 #  define HPAGE_SHIFT   26
 49 # elif defined(CONFIG_HUGETLB_PAGE_SIZE_16MB)
 50 #  define HPAGE_SHIFT   24
 51 # elif defined(CONFIG_HUGETLB_PAGE_SIZE_4MB)
 52 #  define HPAGE_SHIFT   22
 53 # elif defined(CONFIG_HUGETLB_PAGE_SIZE_1MB)
 54 #  define HPAGE_SHIFT   20
 55 # elif defined(CONFIG_HUGETLB_PAGE_SIZE_256KB)
 56 #  define HPAGE_SHIFT   18
 57 # else
 58 #  error Unsupported IA-64 HugeTLB Page Size!
 59 # endif
 60 
 61 # define REGION_HPAGE   (4UL)   /* note: this is hardcoded in mmu_context.h:reload_context()!*/
 62 # define REGION_SHIFT   61
 63 # define HPAGE_SIZE     (__IA64_UL_CONST(1) << HPAGE_SHIFT)
 64 # define HPAGE_MASK     (~(HPAGE_SIZE - 1))
 65 # define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
 66 # define ARCH_HAS_VALID_HUGEPAGE_RANGE
 67 #endif /* CONFIG_HUGETLB_PAGE */
 68 
 69 #ifdef __ASSEMBLY__
 70 # define __pa(x)                ((x) - PAGE_OFFSET)
 71 # define __va(x)                ((x) + PAGE_OFFSET)
 72 #else /* !__ASSEMBLY */
 73 # ifdef __KERNEL__
 74 #  define STRICT_MM_TYPECHECKS
 75 
 76 extern void clear_page (void *page);
 77 extern void copy_page (void *to, void *from);
 78 
 79 /*
 80  * clear_user_page() and copy_user_page() can't be inline functions because
 81  * flush_dcache_page() can't be defined until later...
 82  */
 83 #define clear_user_page(addr, vaddr, page)      \
 84 do {                                            \
 85         clear_page(addr);                       \
 86         flush_dcache_page(page);                \
 87 } while (0)
 88 
 89 #define copy_user_page(to, from, vaddr, page)   \
 90 do {                                            \
 91         copy_page((to), (from));                \
 92         flush_dcache_page(page);                \
 93 } while (0)
 94 
 95 #define virt_addr_valid(kaddr)  pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
 96 
 97 #ifdef CONFIG_VIRTUAL_MEM_MAP
 98 extern int ia64_pfn_valid (unsigned long pfn);
 99 #else
100 # define ia64_pfn_valid(pfn) 1
101 #endif
102 
103 #ifndef CONFIG_DISCONTIGMEM
104 #define pfn_valid(pfn)          (((pfn) < max_mapnr) && ia64_pfn_valid(pfn))
105 #define page_to_pfn(page)       ((unsigned long) (page - mem_map))
106 #define pfn_to_page(pfn)        (mem_map + (pfn))
107 #endif /* CONFIG_DISCONTIGMEM */
108 
109 #define page_to_phys(page)      (page_to_pfn(page) << PAGE_SHIFT)
110 #define virt_to_page(kaddr)     pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
111 
112 typedef union ia64_va {
113         struct {
114                 unsigned long off : 61;         /* intra-region offset */
115                 unsigned long reg :  3;         /* region number */
116         } f;
117         unsigned long l;
118         void *p;
119 } ia64_va;
120 
121 /*
122  * Note: These macros depend on the fact that PAGE_OFFSET has all
123  * region bits set to 1 and all other bits set to zero.  They are
124  * expressed in this way to ensure they result in a single "dep"
125  * instruction.
126  */
127 #define __pa(x)         ({ia64_va _v; _v.l = (long) (x); _v.f.reg = 0; _v.l;})
128 #define __va(x)         ({ia64_va _v; _v.l = (long) (x); _v.f.reg = -1; _v.p;})
129 
130 #define REGION_NUMBER(x)        ({ia64_va _v; _v.l = (long) (x); _v.f.reg;})
131 #define REGION_OFFSET(x)        ({ia64_va _v; _v.l = (long) (x); _v.f.off;})
132 
133 #define REGION_SIZE             REGION_NUMBER(1)
134 #define REGION_KERNEL           7
135 
136 #ifdef CONFIG_HUGETLB_PAGE
137 # define htlbpage_to_page(x)    ((REGION_NUMBER(x) << 61)                               \
138                                  | (REGION_OFFSET(x) >> (HPAGE_SHIFT-PAGE_SHIFT)))
139 # define HUGETLB_PAGE_ORDER     (HPAGE_SHIFT - PAGE_SHIFT)
140 extern int  check_valid_hugepage_range(unsigned long addr, unsigned long len);
141 #endif
142 
143 static __inline__ int
144 get_order (unsigned long size)
145 {
146         double d = size - 1;
147         long order;
148 
149         order = ia64_getf_exp(d);
150         order = order - PAGE_SHIFT - 0xffff + 1;
151         if (order < 0)
152                 order = 0;
153         return order;
154 }
155 
156 # endif /* __KERNEL__ */
157 #endif /* !__ASSEMBLY__ */
158 
159 #ifdef STRICT_MM_TYPECHECKS
160   /*
161    * These are used to make use of C type-checking..
162    */
163   typedef struct { unsigned long pte; } pte_t;
164   typedef struct { unsigned long pmd; } pmd_t;
165   typedef struct { unsigned long pgd; } pgd_t;
166   typedef struct { unsigned long pgprot; } pgprot_t;
167 
168 # define pte_val(x)     ((x).pte)
169 # define pmd_val(x)     ((x).pmd)
170 # define pgd_val(x)     ((x).pgd)
171 # define pgprot_val(x)  ((x).pgprot)
172 
173 # define __pte(x)       ((pte_t) { (x) } )
174 # define __pgprot(x)    ((pgprot_t) { (x) } )
175 
176 #else /* !STRICT_MM_TYPECHECKS */
177   /*
178    * .. while these make it easier on the compiler
179    */
180 # ifndef __ASSEMBLY__
181     typedef unsigned long pte_t;
182     typedef unsigned long pmd_t;
183     typedef unsigned long pgd_t;
184     typedef unsigned long pgprot_t;
185 # endif
186 
187 # define pte_val(x)     (x)
188 # define pmd_val(x)     (x)
189 # define pgd_val(x)     (x)
190 # define pgprot_val(x)  (x)
191 
192 # define __pte(x)       (x)
193 # define __pgd(x)       (x)
194 # define __pgprot(x)    (x)
195 #endif /* !STRICT_MM_TYPECHECKS */
196 
197 #define PAGE_OFFSET                     0xe000000000000000
198 
199 #define VM_DATA_DEFAULT_FLAGS           (VM_READ | VM_WRITE |                                   \
200                                          VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC |                \
201                                          (((current->thread.flags & IA64_THREAD_XSTACK) != 0)   \
202                                           ? VM_EXEC : 0))
203 
204 #endif /* _ASM_IA64_PAGE_H */
205 

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

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | 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.

osdn.jp