blob: 6ef21f191b5029d649fbc64374ac035ba53b7876 [file] [log] [blame]
Tony SIM1d7a8942010-01-28 17:04:55 +09001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 ****************************************************************************
11 ****************************************************************************/
12#ifndef __ASM_SH_PGTABLE_32_H
13#define __ASM_SH_PGTABLE_32_H
14
15#define _PAGE_WT 0x001
16#define _PAGE_HW_SHARED 0x002
17#define _PAGE_DIRTY 0x004
18#define _PAGE_CACHABLE 0x008
19#define _PAGE_SZ0 0x010
20#define _PAGE_RW 0x020
21#define _PAGE_USER 0x040
22#define _PAGE_SZ1 0x080
23#define _PAGE_PRESENT 0x100
24#define _PAGE_PROTNONE 0x200
25#define _PAGE_ACCESSED 0x400
26#define _PAGE_FILE _PAGE_WT
27
28#define _PAGE_SZ_MASK (_PAGE_SZ0 | _PAGE_SZ1)
29#define _PAGE_PR_MASK (_PAGE_RW | _PAGE_USER)
30
31#define _PAGE_EXT_ESZ0 0x0010
32#define _PAGE_EXT_ESZ1 0x0020
33#define _PAGE_EXT_ESZ2 0x0040
34#define _PAGE_EXT_ESZ3 0x0080
35
36#define _PAGE_EXT_USER_EXEC 0x0100
37#define _PAGE_EXT_USER_WRITE 0x0200
38#define _PAGE_EXT_USER_READ 0x0400
39
40#define _PAGE_EXT_KERN_EXEC 0x0800
41#define _PAGE_EXT_KERN_WRITE 0x1000
42#define _PAGE_EXT_KERN_READ 0x2000
43
44#define _PAGE_EXT(x) ((unsigned long long)(x) << 32)
45
46#define _PAGE_PCC_AREA5 0x00000000
47#define _PAGE_PCC_AREA6 0x80000000
48
49#define _PAGE_PCC_IODYN 0x00000001
50#define _PAGE_PCC_IO8 0x20000000
51#define _PAGE_PCC_IO16 0x20000001
52#define _PAGE_PCC_COM8 0x40000000
53#define _PAGE_PCC_COM16 0x40000001
54#define _PAGE_PCC_ATR8 0x60000000
55#define _PAGE_PCC_ATR16 0x60000001
56
57#define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED | _PAGE_FILE)
58
59#define _PAGE_FLAGS_HARDWARE_MASK (PHYS_ADDR_MASK & ~(_PAGE_CLEAR_FLAGS))
60
61#define _PAGE_FLAGS_HARD _PAGE_SZ0
62
63#ifndef _PAGE_SZHUGE
64#define _PAGE_SZHUGE (_PAGE_FLAGS_HARD)
65#endif
66
67#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_CACHABLE | _PAGE_DIRTY)
68
69#ifndef __ASSEMBLY__
70
71#define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_CACHABLE | _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
72
73#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_CACHABLE | _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
74
75#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
76
77#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
78
79#define PAGE_EXECREAD PAGE_READONLY
80#define PAGE_RWX PAGE_SHARED
81#define PAGE_WRITEONLY PAGE_SHARED
82
83#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_CACHABLE | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_HW_SHARED | _PAGE_FLAGS_HARD)
84
85#define PAGE_KERNEL_NOCACHE __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_HW_SHARED | _PAGE_FLAGS_HARD)
86
87#define PAGE_KERNEL_RO __pgprot(_PAGE_PRESENT | _PAGE_CACHABLE | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_HW_SHARED | _PAGE_FLAGS_HARD)
88
89#define PAGE_KERNEL_PCC(slot, type) __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_FLAGS_HARD | (slot ? _PAGE_PCC_AREA5 : _PAGE_PCC_AREA6) | (type))
90
91#endif
92
93#ifndef __ASSEMBLY__
94
95#define set_pte(pteptr, pteval) (*(pteptr) = pteval)
96
97#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
98
99#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval)
100
101#define pfn_pte(pfn, prot) __pte(((unsigned long long)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
102#define pfn_pmd(pfn, prot) __pmd(((unsigned long long)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
103
104#define pte_none(x) (!pte_val(x))
105#define pte_present(x) ((x).pte_low & (_PAGE_PRESENT | _PAGE_PROTNONE))
106
107#define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
108
109#define pmd_none(x) (!pmd_val(x))
110#define pmd_present(x) (pmd_val(x))
111#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0)
112#define pmd_bad(x) (pmd_val(x) & ~PAGE_MASK)
113
114#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
115#define pte_page(x) pfn_to_page(pte_pfn(x))
116
117#define pte_not_present(pte) (!((pte).pte_low & _PAGE_PRESENT))
118#define pte_dirty(pte) ((pte).pte_low & _PAGE_DIRTY)
119#define pte_young(pte) ((pte).pte_low & _PAGE_ACCESSED)
120#define pte_file(pte) ((pte).pte_low & _PAGE_FILE)
121#define pte_special(pte) (0)
122
123#define pte_write(pte) ((pte).pte_low & _PAGE_RW)
124
125#define PTE_BIT_FUNC(h,fn,op) static inline pte_t pte_##fn(pte_t pte) { pte.pte_##h op; return pte; }
126
127#define pgprot_writecombine(prot) __pgprot(pgprot_val(prot) & ~_PAGE_CACHABLE)
128#define pgprot_noncached pgprot_writecombine
129#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
130#define pmd_page_vaddr(pmd) ((unsigned long)pmd_val(pmd))
131#define pmd_page(pmd) (virt_to_page(pmd_val(pmd)))
132#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
133#define pgd_offset(mm, address) ((mm)->pgd+pgd_index(address))
134#define pgd_offset_k(address) pgd_offset(&init_mm, address)
135#define pte_index(address) ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
136#define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
137#define pte_offset_map(dir, address) pte_offset_kernel(dir, address)
138#define pte_offset_map_nested(dir, address) pte_offset_kernel(dir, address)
139#define pte_unmap(pte) do { } while (0)
140#define pte_unmap_nested(pte) do { } while (0)
141#define pte_ERROR(e) printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
142#define pgd_ERROR(e) printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
143#define __swp_type(x) ((x).val & 0xff)
144#define __swp_offset(x) ((x).val >> 10)
145#define __swp_entry(type, offset) ((swp_entry_t){(type) | (offset) <<10})
146#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) >> 1 })
147#define __swp_entry_to_pte(x) ((pte_t) { (x).val << 1 })
148#define PTE_FILE_MAX_BITS 29
149#define pte_to_pgoff(pte) (pte_val(pte) >> 1)
150#define pgoff_to_pte(off) ((pte_t) { ((off) << 1) | _PAGE_FILE })
151#endif
152#endif