GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / arch / sh / include / asm / pgtable_32.h
blob3dd754c1e1fe249f41fdfeb1cf78799424469b51
1 #ifndef __ASM_SH_PGTABLE_32_H
2 #define __ASM_SH_PGTABLE_32_H
4 /* Legacy and compat mode bits */
5 #define _PAGE_WT 0x001 /* WT-bit on SH-4, 0 on SH-3 */
6 #define _PAGE_HW_SHARED 0x002 /* SH-bit : shared among processes */
7 #define _PAGE_DIRTY 0x004 /* D-bit : page changed */
8 #define _PAGE_CACHABLE 0x008 /* C-bit : cachable */
9 #define _PAGE_SZ0 0x010 /* SZ0-bit : Size of page */
10 #define _PAGE_RW 0x020
11 #define _PAGE_USER 0x040
12 #define _PAGE_SZ1 0x080 /* SZ1-bit : Size of page (on SH-4) */
13 #define _PAGE_PRESENT 0x100 /* V-bit : page is valid */
14 #define _PAGE_PROTNONE 0x200 /* software: if not present */
15 #define _PAGE_ACCESSED 0x400 /* software: page referenced */
16 #define _PAGE_FILE _PAGE_WT /* software: pagecache or swap? */
17 #define _PAGE_SPECIAL 0x800 /* software: special page */
19 #define _PAGE_SZ_MASK (_PAGE_SZ0 | _PAGE_SZ1)
20 #define _PAGE_PR_MASK (_PAGE_RW | _PAGE_USER)
22 /* Extended mode bits */
23 #define _PAGE_EXT_ESZ0 0x0010 /* ESZ0-bit: Size of page */
24 #define _PAGE_EXT_ESZ1 0x0020 /* ESZ1-bit: Size of page */
25 #define _PAGE_EXT_ESZ2 0x0040 /* ESZ2-bit: Size of page */
26 #define _PAGE_EXT_ESZ3 0x0080 /* ESZ3-bit: Size of page */
28 #define _PAGE_EXT_USER_EXEC 0x0100 /* EPR0-bit: User space executable */
29 #define _PAGE_EXT_USER_WRITE 0x0200 /* EPR1-bit: User space writable */
30 #define _PAGE_EXT_USER_READ 0x0400 /* EPR2-bit: User space readable */
32 #define _PAGE_EXT_KERN_EXEC 0x0800 /* EPR3-bit: Kernel space executable */
33 #define _PAGE_EXT_KERN_WRITE 0x1000 /* EPR4-bit: Kernel space writable */
34 #define _PAGE_EXT_KERN_READ 0x2000 /* EPR5-bit: Kernel space readable */
36 #define _PAGE_EXT_WIRED 0x4000 /* software: Wire TLB entry */
38 /* Wrapper for extended mode pgprot twiddling */
39 #define _PAGE_EXT(x) ((unsigned long long)(x) << 32)
41 #ifdef CONFIG_X2TLB
42 #define _PAGE_PCC_MASK 0x00000000 /* No legacy PTEA support */
43 #else
45 /* software: moves to PTEA.TC (Timing Control) */
46 #define _PAGE_PCC_AREA5 0x00000000 /* use BSC registers for area5 */
47 #define _PAGE_PCC_AREA6 0x80000000 /* use BSC registers for area6 */
49 /* software: moves to PTEA.SA[2:0] (Space Attributes) */
50 #define _PAGE_PCC_IODYN 0x00000001 /* IO space, dynamically sized bus */
51 #define _PAGE_PCC_IO8 0x20000000 /* IO space, 8 bit bus */
52 #define _PAGE_PCC_IO16 0x20000001 /* IO space, 16 bit bus */
53 #define _PAGE_PCC_COM8 0x40000000 /* Common Memory space, 8 bit bus */
54 #define _PAGE_PCC_COM16 0x40000001 /* Common Memory space, 16 bit bus */
55 #define _PAGE_PCC_ATR8 0x60000000 /* Attribute Memory space, 8 bit bus */
56 #define _PAGE_PCC_ATR16 0x60000001 /* Attribute Memory space, 6 bit bus */
58 #define _PAGE_PCC_MASK 0xe0000001
60 /* copy the ptea attributes */
61 static inline unsigned long copy_ptea_attributes(unsigned long x)
63 return ((x >> 28) & 0xe) | (x & 0x1);
65 #endif
67 /* Mask which drops unused bits from the PTEL value */
68 #if defined(CONFIG_CPU_SH3)
69 #define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED| \
70 _PAGE_FILE | _PAGE_SZ1 | \
71 _PAGE_HW_SHARED)
72 #elif defined(CONFIG_X2TLB)
73 /* Get rid of the legacy PR/SZ bits when using extended mode */
74 #define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED | \
75 _PAGE_FILE | _PAGE_PR_MASK | _PAGE_SZ_MASK)
76 #else
77 #define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED | _PAGE_FILE)
78 #endif
80 #define _PAGE_FLAGS_HARDWARE_MASK (phys_addr_mask() & ~(_PAGE_CLEAR_FLAGS))
82 /* Hardware flags, page size encoding */
83 #if !defined(CONFIG_MMU)
84 # define _PAGE_FLAGS_HARD 0ULL
85 #elif defined(CONFIG_X2TLB)
86 # if defined(CONFIG_PAGE_SIZE_4KB)
87 # define _PAGE_FLAGS_HARD _PAGE_EXT(_PAGE_EXT_ESZ0)
88 # elif defined(CONFIG_PAGE_SIZE_8KB)
89 # define _PAGE_FLAGS_HARD _PAGE_EXT(_PAGE_EXT_ESZ1)
90 # elif defined(CONFIG_PAGE_SIZE_64KB)
91 # define _PAGE_FLAGS_HARD _PAGE_EXT(_PAGE_EXT_ESZ2)
92 # endif
93 #else
94 # if defined(CONFIG_PAGE_SIZE_4KB)
95 # define _PAGE_FLAGS_HARD _PAGE_SZ0
96 # elif defined(CONFIG_PAGE_SIZE_64KB)
97 # define _PAGE_FLAGS_HARD _PAGE_SZ1
98 # endif
99 #endif
101 #if defined(CONFIG_X2TLB)
102 # if defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
103 # define _PAGE_SZHUGE (_PAGE_EXT_ESZ2)
104 # elif defined(CONFIG_HUGETLB_PAGE_SIZE_256K)
105 # define _PAGE_SZHUGE (_PAGE_EXT_ESZ0 | _PAGE_EXT_ESZ2)
106 # elif defined(CONFIG_HUGETLB_PAGE_SIZE_1MB)
107 # define _PAGE_SZHUGE (_PAGE_EXT_ESZ0 | _PAGE_EXT_ESZ1 | _PAGE_EXT_ESZ2)
108 # elif defined(CONFIG_HUGETLB_PAGE_SIZE_4MB)
109 # define _PAGE_SZHUGE (_PAGE_EXT_ESZ3)
110 # elif defined(CONFIG_HUGETLB_PAGE_SIZE_64MB)
111 # define _PAGE_SZHUGE (_PAGE_EXT_ESZ2 | _PAGE_EXT_ESZ3)
112 # endif
113 # define _PAGE_WIRED (_PAGE_EXT(_PAGE_EXT_WIRED))
114 #else
115 # if defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
116 # define _PAGE_SZHUGE (_PAGE_SZ1)
117 # elif defined(CONFIG_HUGETLB_PAGE_SIZE_1MB)
118 # define _PAGE_SZHUGE (_PAGE_SZ0 | _PAGE_SZ1)
119 # endif
120 # define _PAGE_WIRED (0)
121 #endif
124 * Stub out _PAGE_SZHUGE if we don't have a good definition for it,
125 * to make pte_mkhuge() happy.
127 #ifndef _PAGE_SZHUGE
128 # define _PAGE_SZHUGE (_PAGE_FLAGS_HARD)
129 #endif
132 * Mask of bits that are to be preserved accross pgprot changes.
134 #define _PAGE_CHG_MASK \
135 (PTE_MASK | _PAGE_ACCESSED | _PAGE_CACHABLE | \
136 _PAGE_DIRTY | _PAGE_SPECIAL)
138 #ifndef __ASSEMBLY__
140 #if defined(CONFIG_X2TLB) /* SH-X2 TLB */
141 #define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_CACHABLE | \
142 _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
144 #define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
145 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
146 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
147 _PAGE_EXT_KERN_WRITE | \
148 _PAGE_EXT_USER_READ | \
149 _PAGE_EXT_USER_WRITE))
151 #define PAGE_EXECREAD __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
152 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
153 _PAGE_EXT(_PAGE_EXT_KERN_EXEC | \
154 _PAGE_EXT_KERN_READ | \
155 _PAGE_EXT_USER_EXEC | \
156 _PAGE_EXT_USER_READ))
158 #define PAGE_COPY PAGE_EXECREAD
160 #define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
161 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
162 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
163 _PAGE_EXT_USER_READ))
165 #define PAGE_WRITEONLY __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
166 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
167 _PAGE_EXT(_PAGE_EXT_KERN_WRITE | \
168 _PAGE_EXT_USER_WRITE))
170 #define PAGE_RWX __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
171 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
172 _PAGE_EXT(_PAGE_EXT_KERN_WRITE | \
173 _PAGE_EXT_KERN_READ | \
174 _PAGE_EXT_KERN_EXEC | \
175 _PAGE_EXT_USER_WRITE | \
176 _PAGE_EXT_USER_READ | \
177 _PAGE_EXT_USER_EXEC))
179 #define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_CACHABLE | \
180 _PAGE_DIRTY | _PAGE_ACCESSED | \
181 _PAGE_HW_SHARED | _PAGE_FLAGS_HARD | \
182 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
183 _PAGE_EXT_KERN_WRITE | \
184 _PAGE_EXT_KERN_EXEC))
186 #define PAGE_KERNEL_NOCACHE \
187 __pgprot(_PAGE_PRESENT | _PAGE_DIRTY | \
188 _PAGE_ACCESSED | _PAGE_HW_SHARED | \
189 _PAGE_FLAGS_HARD | \
190 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
191 _PAGE_EXT_KERN_WRITE | \
192 _PAGE_EXT_KERN_EXEC))
194 #define PAGE_KERNEL_RO __pgprot(_PAGE_PRESENT | _PAGE_CACHABLE | \
195 _PAGE_DIRTY | _PAGE_ACCESSED | \
196 _PAGE_HW_SHARED | _PAGE_FLAGS_HARD | \
197 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
198 _PAGE_EXT_KERN_EXEC))
200 #define PAGE_KERNEL_PCC(slot, type) \
201 __pgprot(_PAGE_PRESENT | _PAGE_DIRTY | \
202 _PAGE_ACCESSED | _PAGE_FLAGS_HARD | \
203 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
204 _PAGE_EXT_KERN_WRITE | \
205 _PAGE_EXT_KERN_EXEC) \
206 (slot ? _PAGE_PCC_AREA5 : _PAGE_PCC_AREA6) | \
207 (type))
209 #elif defined(CONFIG_MMU) /* SH-X TLB */
210 #define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_CACHABLE | \
211 _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
213 #define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | \
214 _PAGE_CACHABLE | _PAGE_ACCESSED | \
215 _PAGE_FLAGS_HARD)
217 #define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | \
218 _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
220 #define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | \
221 _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
223 #define PAGE_EXECREAD PAGE_READONLY
224 #define PAGE_RWX PAGE_SHARED
225 #define PAGE_WRITEONLY PAGE_SHARED
227 #define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_CACHABLE | \
228 _PAGE_DIRTY | _PAGE_ACCESSED | \
229 _PAGE_HW_SHARED | _PAGE_FLAGS_HARD)
231 #define PAGE_KERNEL_NOCACHE \
232 __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | \
233 _PAGE_ACCESSED | _PAGE_HW_SHARED | \
234 _PAGE_FLAGS_HARD)
236 #define PAGE_KERNEL_RO __pgprot(_PAGE_PRESENT | _PAGE_CACHABLE | \
237 _PAGE_DIRTY | _PAGE_ACCESSED | \
238 _PAGE_HW_SHARED | _PAGE_FLAGS_HARD)
240 #define PAGE_KERNEL_PCC(slot, type) \
241 __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | \
242 _PAGE_ACCESSED | _PAGE_FLAGS_HARD | \
243 (slot ? _PAGE_PCC_AREA5 : _PAGE_PCC_AREA6) | \
244 (type))
245 #else /* no mmu */
246 #define PAGE_NONE __pgprot(0)
247 #define PAGE_SHARED __pgprot(0)
248 #define PAGE_COPY __pgprot(0)
249 #define PAGE_EXECREAD __pgprot(0)
250 #define PAGE_RWX __pgprot(0)
251 #define PAGE_READONLY __pgprot(0)
252 #define PAGE_WRITEONLY __pgprot(0)
253 #define PAGE_KERNEL __pgprot(0)
254 #define PAGE_KERNEL_NOCACHE __pgprot(0)
255 #define PAGE_KERNEL_RO __pgprot(0)
257 #define PAGE_KERNEL_PCC(slot, type) \
258 __pgprot(0)
259 #endif
261 #endif /* __ASSEMBLY__ */
263 #ifndef __ASSEMBLY__
266 * Certain architectures need to do special things when PTEs
267 * within a page table are directly modified. Thus, the following
268 * hook is made available.
270 #ifdef CONFIG_X2TLB
271 static inline void set_pte(pte_t *ptep, pte_t pte)
273 ptep->pte_high = pte.pte_high;
274 smp_wmb();
275 ptep->pte_low = pte.pte_low;
277 #else
278 #define set_pte(pteptr, pteval) (*(pteptr) = pteval)
279 #endif
281 #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
284 * (pmds are folded into pgds so this doesn't get actually called,
285 * but the define is needed for a generic inline function.)
287 #define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval)
289 #define pfn_pte(pfn, prot) \
290 __pte(((unsigned long long)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
291 #define pfn_pmd(pfn, prot) \
292 __pmd(((unsigned long long)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
294 #define pte_none(x) (!pte_val(x))
295 #define pte_present(x) ((x).pte_low & (_PAGE_PRESENT | _PAGE_PROTNONE))
297 #define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
299 #define pmd_none(x) (!pmd_val(x))
300 #define pmd_present(x) (pmd_val(x))
301 #define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0)
302 #define pmd_bad(x) (pmd_val(x) & ~PAGE_MASK)
304 #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
305 #define pte_page(x) pfn_to_page(pte_pfn(x))
308 * The following only work if pte_present() is true.
309 * Undefined behaviour if not..
311 #define pte_not_present(pte) (!((pte).pte_low & _PAGE_PRESENT))
312 #define pte_dirty(pte) ((pte).pte_low & _PAGE_DIRTY)
313 #define pte_young(pte) ((pte).pte_low & _PAGE_ACCESSED)
314 #define pte_file(pte) ((pte).pte_low & _PAGE_FILE)
315 #define pte_special(pte) ((pte).pte_low & _PAGE_SPECIAL)
317 #ifdef CONFIG_X2TLB
318 #define pte_write(pte) \
319 ((pte).pte_high & (_PAGE_EXT_USER_WRITE | _PAGE_EXT_KERN_WRITE))
320 #else
321 #define pte_write(pte) ((pte).pte_low & _PAGE_RW)
322 #endif
324 #define PTE_BIT_FUNC(h,fn,op) \
325 static inline pte_t pte_##fn(pte_t pte) { pte.pte_##h op; return pte; }
327 #ifdef CONFIG_X2TLB
329 * We cheat a bit in the SH-X2 TLB case. As the permission bits are
330 * individually toggled (and user permissions are entirely decoupled from
331 * kernel permissions), we attempt to couple them a bit more sanely here.
333 PTE_BIT_FUNC(high, wrprotect, &= ~(_PAGE_EXT_USER_WRITE | _PAGE_EXT_KERN_WRITE));
334 PTE_BIT_FUNC(high, mkwrite, |= _PAGE_EXT_USER_WRITE | _PAGE_EXT_KERN_WRITE);
335 PTE_BIT_FUNC(high, mkhuge, |= _PAGE_SZHUGE);
336 #else
337 PTE_BIT_FUNC(low, wrprotect, &= ~_PAGE_RW);
338 PTE_BIT_FUNC(low, mkwrite, |= _PAGE_RW);
339 PTE_BIT_FUNC(low, mkhuge, |= _PAGE_SZHUGE);
340 #endif
342 PTE_BIT_FUNC(low, mkclean, &= ~_PAGE_DIRTY);
343 PTE_BIT_FUNC(low, mkdirty, |= _PAGE_DIRTY);
344 PTE_BIT_FUNC(low, mkold, &= ~_PAGE_ACCESSED);
345 PTE_BIT_FUNC(low, mkyoung, |= _PAGE_ACCESSED);
346 PTE_BIT_FUNC(low, mkspecial, |= _PAGE_SPECIAL);
348 #define __HAVE_ARCH_PTE_SPECIAL
351 * Macro and implementation to make a page protection as uncachable.
353 #define pgprot_writecombine(prot) \
354 __pgprot(pgprot_val(prot) & ~_PAGE_CACHABLE)
356 #define pgprot_noncached pgprot_writecombine
359 * Conversion functions: convert a page and protection to a page entry,
360 * and a page entry and page directory to the page they refer to.
362 * extern pte_t mk_pte(struct page *page, pgprot_t pgprot)
364 #define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
366 static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
368 pte.pte_low &= _PAGE_CHG_MASK;
369 pte.pte_low |= pgprot_val(newprot);
371 #ifdef CONFIG_X2TLB
372 pte.pte_high |= pgprot_val(newprot) >> 32;
373 #endif
375 return pte;
378 #define pmd_page_vaddr(pmd) ((unsigned long)pmd_val(pmd))
379 #define pmd_page(pmd) (virt_to_page(pmd_val(pmd)))
381 /* to find an entry in a page-table-directory. */
382 #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
383 #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
384 #define __pgd_offset(address) pgd_index(address)
386 /* to find an entry in a kernel page-table-directory */
387 #define pgd_offset_k(address) pgd_offset(&init_mm, address)
389 #define __pud_offset(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
390 #define __pmd_offset(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
392 /* Find an entry in the third-level page table.. */
393 #define pte_index(address) ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
394 #define __pte_offset(address) pte_index(address)
396 #define pte_offset_kernel(dir, address) \
397 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
398 #define pte_offset_map(dir, address) pte_offset_kernel(dir, address)
399 #define pte_offset_map_nested(dir, address) pte_offset_kernel(dir, address)
401 #define pte_unmap(pte) do { } while (0)
402 #define pte_unmap_nested(pte) do { } while (0)
404 #ifdef CONFIG_X2TLB
405 #define pte_ERROR(e) \
406 printk("%s:%d: bad pte %p(%08lx%08lx).\n", __FILE__, __LINE__, \
407 &(e), (e).pte_high, (e).pte_low)
408 #define pgd_ERROR(e) \
409 printk("%s:%d: bad pgd %016llx.\n", __FILE__, __LINE__, pgd_val(e))
410 #else
411 #define pte_ERROR(e) \
412 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
413 #define pgd_ERROR(e) \
414 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
415 #endif
418 * Encode and de-code a swap entry
420 * Constraints:
421 * _PAGE_FILE at bit 0
422 * _PAGE_PRESENT at bit 8
423 * _PAGE_PROTNONE at bit 9
425 * For the normal case, we encode the swap type into bits 0:7 and the
426 * swap offset into bits 10:30. For the 64-bit PTE case, we keep the
427 * preserved bits in the low 32-bits and use the upper 32 as the swap
428 * offset (along with a 5-bit type), following the same approach as x86
429 * PAE. This keeps the logic quite simple, and allows for a full 32
430 * PTE_FILE_MAX_BITS, as opposed to the 29-bits we're constrained with
431 * in the pte_low case.
433 * As is evident by the Alpha code, if we ever get a 64-bit unsigned
434 * long (swp_entry_t) to match up with the 64-bit PTEs, this all becomes
435 * much cleaner..
437 * NOTE: We should set ZEROs at the position of _PAGE_PRESENT
438 * and _PAGE_PROTNONE bits
440 #ifdef CONFIG_X2TLB
441 #define __swp_type(x) ((x).val & 0x1f)
442 #define __swp_offset(x) ((x).val >> 5)
443 #define __swp_entry(type, offset) ((swp_entry_t){ (type) | (offset) << 5})
444 #define __pte_to_swp_entry(pte) ((swp_entry_t){ (pte).pte_high })
445 #define __swp_entry_to_pte(x) ((pte_t){ 0, (x).val })
448 * Encode and decode a nonlinear file mapping entry
450 #define pte_to_pgoff(pte) ((pte).pte_high)
451 #define pgoff_to_pte(off) ((pte_t) { _PAGE_FILE, (off) })
453 #define PTE_FILE_MAX_BITS 32
454 #else
455 #define __swp_type(x) ((x).val & 0xff)
456 #define __swp_offset(x) ((x).val >> 10)
457 #define __swp_entry(type, offset) ((swp_entry_t){(type) | (offset) <<10})
459 #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) >> 1 })
460 #define __swp_entry_to_pte(x) ((pte_t) { (x).val << 1 })
463 * Encode and decode a nonlinear file mapping entry
465 #define PTE_FILE_MAX_BITS 29
466 #define pte_to_pgoff(pte) (pte_val(pte) >> 1)
467 #define pgoff_to_pte(off) ((pte_t) { ((off) << 1) | _PAGE_FILE })
468 #endif
470 #endif /* __ASSEMBLY__ */
471 #endif /* __ASM_SH_PGTABLE_32_H */