1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef _ASM_TILE_PGTABLE_32_H
17#define _ASM_TILE_PGTABLE_32_H
18
19
20
21
22
23#define PGDIR_SHIFT HPAGE_SHIFT
24#define PGDIR_SIZE HPAGE_SIZE
25#define PGDIR_MASK (~(PGDIR_SIZE-1))
26#define PTRS_PER_PGD _HV_L1_ENTRIES(HPAGE_SHIFT)
27#define PGD_INDEX(va) _HV_L1_INDEX(va, HPAGE_SHIFT)
28#define SIZEOF_PGD _HV_L1_SIZE(HPAGE_SHIFT)
29
30
31
32
33
34
35
36
37#define PTRS_PER_PTE _HV_L2_ENTRIES(HPAGE_SHIFT, PAGE_SHIFT)
38#define PTE_INDEX(va) _HV_L2_INDEX(va, HPAGE_SHIFT, PAGE_SHIFT)
39#define SIZEOF_PTE _HV_L2_SIZE(HPAGE_SHIFT, PAGE_SHIFT)
40
41#ifndef __ASSEMBLY__
42
43
44
45
46
47
48
49
50
51
52
53#define LAST_PKMAP PTRS_PER_PTE
54
55#define PKMAP_BASE ((FIXADDR_BOOT_START - PAGE_SIZE*LAST_PKMAP) & PGDIR_MASK)
56
57#ifdef CONFIG_HIGHMEM
58# define __VMAPPING_END (PKMAP_BASE & ~(HPAGE_SIZE-1))
59#else
60# define __VMAPPING_END (FIXADDR_START & ~(HPAGE_SIZE-1))
61#endif
62
63#ifdef CONFIG_HUGEVMAP
64#define HUGE_VMAP_END __VMAPPING_END
65#define HUGE_VMAP_BASE (HUGE_VMAP_END - CONFIG_NR_HUGE_VMAPS * HPAGE_SIZE)
66#define _VMALLOC_END HUGE_VMAP_BASE
67#else
68#define _VMALLOC_END __VMAPPING_END
69#endif
70
71
72
73
74
75
76#define VMALLOC_END (_VMALLOC_END - PAGE_SIZE)
77extern unsigned long VMALLOC_RESERVE ;
78#define _VMALLOC_START (_VMALLOC_END - VMALLOC_RESERVE)
79#define VMALLOC_START (_VMALLOC_START + PAGE_SIZE)
80
81
82#define MAXMEM (_VMALLOC_START - PAGE_OFFSET)
83
84
85#include <asm-generic/pgtable-nopmd.h>
86
87
88static inline int pgd_addr_invalid(unsigned long addr)
89{
90 return addr >= MEM_HV_INTRPT;
91}
92
93
94
95
96
97
98
99#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
100#define __HAVE_ARCH_PTEP_SET_WRPROTECT
101
102extern int ptep_test_and_clear_young(struct vm_area_struct *,
103 unsigned long addr, pte_t *);
104extern void ptep_set_wrprotect(struct mm_struct *,
105 unsigned long addr, pte_t *);
106
107#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
108static inline pte_t ptep_get_and_clear(struct mm_struct *mm,
109 unsigned long addr, pte_t *ptep)
110{
111 pte_t pte = *ptep;
112 pte_clear(_mm, addr, ptep);
113 return pte;
114}
115
116
117
118
119
120
121#define pmd_pte(pmd) ((pmd).pud.pgd)
122#define pmdp_ptep(pmdp) (&(pmdp)->pud.pgd)
123#define pte_pmd(pte) ((pmd_t){ { (pte) } })
124
125#endif
126
127#endif
128