Go to the documentation of this file. 1 #ifndef __ASM_SH_PAGE_H
2 #define __ASM_SH_PAGE_H
8 #include <linux/const.h>
11 #if defined(CONFIG_PAGE_SIZE_4KB)
12 # define PAGE_SHIFT 12
13 #elif defined(CONFIG_PAGE_SIZE_8KB)
14 # define PAGE_SHIFT 13
15 #elif defined(CONFIG_PAGE_SIZE_16KB)
16 # define PAGE_SHIFT 14
17 #elif defined(CONFIG_PAGE_SIZE_64KB)
18 # define PAGE_SHIFT 16
20 # error "Bogus kernel page size?"
23 #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
24 #define PAGE_MASK (~(PAGE_SIZE-1))
25 #define PTE_MASK PAGE_MASK
27 #if defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
28 #define HPAGE_SHIFT 16
29 #elif defined(CONFIG_HUGETLB_PAGE_SIZE_256K)
30 #define HPAGE_SHIFT 18
31 #elif defined(CONFIG_HUGETLB_PAGE_SIZE_1MB)
32 #define HPAGE_SHIFT 20
33 #elif defined(CONFIG_HUGETLB_PAGE_SIZE_4MB)
34 #define HPAGE_SHIFT 22
35 #elif defined(CONFIG_HUGETLB_PAGE_SIZE_64MB)
36 #define HPAGE_SHIFT 26
37 #elif defined(CONFIG_HUGETLB_PAGE_SIZE_512MB)
38 #define HPAGE_SHIFT 29
41 #ifdef CONFIG_HUGETLB_PAGE
42 #define HPAGE_SIZE (1UL << HPAGE_SHIFT)
43 #define HPAGE_MASK (~(HPAGE_SIZE-1))
44 #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT-PAGE_SHIFT)
48 #include <asm/uncached.h>
54 static inline unsigned long
55 pages_do_alias(
unsigned long addr1,
unsigned long addr2)
60 #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
68 #define __HAVE_ARCH_COPY_USER_HIGHPAGE
70 #define clear_user_highpage clear_user_highpage
76 typedef struct {
unsigned long pte_low, pte_high; }
pte_t;
78 typedef struct {
unsigned long long pgd; }
pgd_t;
80 ((x).pte_low | ((unsigned long long)(x).pte_high << 32))
82 ({ pte_t __pte = {(x), ((unsigned long long)(x)) >> 32}; __pte; })
83 #elif defined(CONFIG_SUPERH32)
84 typedef struct {
unsigned long pte_low; }
pte_t;
86 typedef struct {
unsigned long pgd; }
pgd_t;
87 #define pte_val(x) ((x).pte_low)
88 #define __pte(x) ((pte_t) { (x) } )
92 typedef struct {
unsigned long pgd; }
pgd_t;
93 #define pte_val(x) ((x).pte_low)
94 #define __pte(x) ((pte_t) { (x) } )
97 #define pgd_val(x) ((x).pgd)
98 #define pgprot_val(x) ((x).pgprot)
100 #define __pgd(x) ((pgd_t) { (x) } )
101 #define __pgprot(x) ((pgprot_t) { (x) } )
105 #define pte_pgprot(x) __pgprot(pte_val(x) & PTE_FLAGS_MASK)
112 #define __MEMORY_START CONFIG_MEMORY_START
113 #define __MEMORY_SIZE CONFIG_MEMORY_SIZE
119 #ifdef CONFIG_PHYSICAL_START
120 #define PHYSICAL_OFFSET (CONFIG_PHYSICAL_START - __MEMORY_START)
122 #define PHYSICAL_OFFSET 0
129 #define PAGE_OFFSET CONFIG_PAGE_OFFSET
141 #define ___pa(x) ((x)-PAGE_OFFSET+__MEMORY_START)
142 #define ___va(x) ((x)+PAGE_OFFSET-__MEMORY_START)
144 #define ___pa(x) ((x)-PAGE_OFFSET)
145 #define ___va(x) ((x)+PAGE_OFFSET)
149 #define __pa(x) ___pa((unsigned long)x)
150 #define __va(x) (void *)___va((unsigned long)x)
153 #ifdef CONFIG_UNCACHED_MAPPING
154 #if defined(CONFIG_29BIT)
155 #define UNCAC_ADDR(addr) P2SEGADDR(addr)
156 #define CAC_ADDR(addr) P1SEGADDR(addr)
158 #define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + uncached_start)
159 #define CAC_ADDR(addr) ((addr) - uncached_start + PAGE_OFFSET)
162 #define UNCAC_ADDR(addr) ((addr))
163 #define CAC_ADDR(addr) ((addr))
166 #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
167 #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
175 #define PFN_START (__MEMORY_START >> PAGE_SHIFT)
176 #define ARCH_PFN_OFFSET (PFN_START)
177 #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
178 #ifdef CONFIG_FLATMEM
179 #define pfn_valid(pfn) ((pfn) >= min_low_pfn && (pfn) < max_low_pfn)
181 #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
183 #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
184 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
190 #ifdef CONFIG_VSYSCALL
191 #define __HAVE_ARCH_GATE_AREA
198 #define ARCH_DMA_MINALIGN L1_CACHE_BYTES
200 #ifdef CONFIG_SUPERH64
208 #define ARCH_SLAB_MINALIGN 8