aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/um/kernel/mem.c17
-rw-r--r--include/asm-um/page.h6
-rw-r--r--include/asm-um/pgtable-3level.h21
-rw-r--r--include/asm-um/pgtable.h2
4 files changed, 33 insertions, 13 deletions
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 3eddc2091d4d..663011c2983f 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -132,7 +132,7 @@ static void __init fixrange_init(unsigned long start, unsigned long end,
132 if (pud_none(*pud)) 132 if (pud_none(*pud))
133 one_md_table_init(pud); 133 one_md_table_init(pud);
134 pmd = pmd_offset(pud, vaddr); 134 pmd = pmd_offset(pud, vaddr);
135 for (; (j < PTRS_PER_PMD) && (vaddr != end); pmd++, j++) { 135 for (; (j < PTRS_PER_PMD) && (vaddr < end); pmd++, j++) {
136 one_page_table_init(pmd); 136 one_page_table_init(pmd);
137 vaddr += PMD_SIZE; 137 vaddr += PMD_SIZE;
138 } 138 }
@@ -191,22 +191,23 @@ static void __init fixaddr_user_init( void)
191 pud_t *pud; 191 pud_t *pud;
192 pmd_t *pmd; 192 pmd_t *pmd;
193 pte_t *pte; 193 pte_t *pte;
194 unsigned long paddr, vaddr = FIXADDR_USER_START; 194 phys_t p;
195 unsigned long v, vaddr = FIXADDR_USER_START;
195 196
196 if ( ! size ) 197 if (!size)
197 return; 198 return;
198 199
199 fixrange_init( FIXADDR_USER_START, FIXADDR_USER_END, swapper_pg_dir); 200 fixrange_init( FIXADDR_USER_START, FIXADDR_USER_END, swapper_pg_dir);
200 paddr = (unsigned long)alloc_bootmem_low_pages( size); 201 v = (unsigned long) alloc_bootmem_low_pages(size);
201 memcpy( (void *)paddr, (void *)FIXADDR_USER_START, size); 202 memcpy((void *) v , (void *) FIXADDR_USER_START, size);
202 paddr = __pa(paddr); 203 p = __pa(v);
203 for ( ; size > 0; size -= PAGE_SIZE, vaddr += PAGE_SIZE, 204 for ( ; size > 0; size -= PAGE_SIZE, vaddr += PAGE_SIZE,
204 paddr += PAGE_SIZE) { 205 p += PAGE_SIZE) {
205 pgd = swapper_pg_dir + pgd_index(vaddr); 206 pgd = swapper_pg_dir + pgd_index(vaddr);
206 pud = pud_offset(pgd, vaddr); 207 pud = pud_offset(pgd, vaddr);
207 pmd = pmd_offset(pud, vaddr); 208 pmd = pmd_offset(pud, vaddr);
208 pte = pte_offset_kernel(pmd, vaddr); 209 pte = pte_offset_kernel(pmd, vaddr);
209 pte_set_val( (*pte), paddr, PAGE_READONLY); 210 pte_set_val(*pte, p, PAGE_READONLY);
210 } 211 }
211#endif 212#endif
212} 213}
diff --git a/include/asm-um/page.h b/include/asm-um/page.h
index 4b424c75fca5..fe2374d705d1 100644
--- a/include/asm-um/page.h
+++ b/include/asm-um/page.h
@@ -30,7 +30,7 @@ struct page;
30#if defined(CONFIG_3_LEVEL_PGTABLES) && !defined(CONFIG_64BIT) 30#if defined(CONFIG_3_LEVEL_PGTABLES) && !defined(CONFIG_64BIT)
31 31
32typedef struct { unsigned long pte_low, pte_high; } pte_t; 32typedef struct { unsigned long pte_low, pte_high; } pte_t;
33typedef struct { unsigned long long pmd; } pmd_t; 33typedef struct { unsigned long pmd; } pmd_t;
34typedef struct { unsigned long pgd; } pgd_t; 34typedef struct { unsigned long pgd; } pgd_t;
35#define pte_val(x) ((x).pte_low | ((unsigned long long) (x).pte_high << 32)) 35#define pte_val(x) ((x).pte_low | ((unsigned long long) (x).pte_high << 32))
36 36
@@ -106,8 +106,8 @@ extern unsigned long uml_physmem;
106#define __pa(virt) to_phys((void *) (unsigned long) (virt)) 106#define __pa(virt) to_phys((void *) (unsigned long) (virt))
107#define __va(phys) to_virt((unsigned long) (phys)) 107#define __va(phys) to_virt((unsigned long) (phys))
108 108
109#define phys_to_pfn(p) ((p) >> PAGE_SHIFT) 109#define phys_to_pfn(p) ((pfn_t) ((p) >> PAGE_SHIFT))
110#define pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT) 110#define pfn_to_phys(pfn) ((phys_t) ((pfn) << PAGE_SHIFT))
111 111
112#define pfn_valid(pfn) ((pfn) < max_mapnr) 112#define pfn_valid(pfn) ((pfn) < max_mapnr)
113#define virt_addr_valid(v) pfn_valid(phys_to_pfn(__pa(v))) 113#define virt_addr_valid(v) pfn_valid(phys_to_pfn(__pa(v)))
diff --git a/include/asm-um/pgtable-3level.h b/include/asm-um/pgtable-3level.h
index e0b6c16a3a41..48f8f5d96d20 100644
--- a/include/asm-um/pgtable-3level.h
+++ b/include/asm-um/pgtable-3level.h
@@ -11,7 +11,11 @@
11 11
12/* PGDIR_SHIFT determines what a third-level page table entry can map */ 12/* PGDIR_SHIFT determines what a third-level page table entry can map */
13 13
14#ifdef CONFIG_64BIT
14#define PGDIR_SHIFT 30 15#define PGDIR_SHIFT 30
16#else
17#define PGDIR_SHIFT 31
18#endif
15#define PGDIR_SIZE (1UL << PGDIR_SHIFT) 19#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
16#define PGDIR_MASK (~(PGDIR_SIZE-1)) 20#define PGDIR_MASK (~(PGDIR_SIZE-1))
17 21
@@ -28,9 +32,15 @@
28 */ 32 */
29 33
30#define PTRS_PER_PTE 512 34#define PTRS_PER_PTE 512
35#ifdef CONFIG_64BIT
31#define PTRS_PER_PMD 512 36#define PTRS_PER_PMD 512
32#define USER_PTRS_PER_PGD ((TASK_SIZE + (PGDIR_SIZE - 1)) / PGDIR_SIZE)
33#define PTRS_PER_PGD 512 37#define PTRS_PER_PGD 512
38#else
39#define PTRS_PER_PMD 1024
40#define PTRS_PER_PGD 1024
41#endif
42
43#define USER_PTRS_PER_PGD ((TASK_SIZE + (PGDIR_SIZE - 1)) / PGDIR_SIZE)
34#define FIRST_USER_ADDRESS 0 44#define FIRST_USER_ADDRESS 0
35 45
36#define pte_ERROR(e) \ 46#define pte_ERROR(e) \
@@ -49,7 +59,12 @@
49#define pud_populate(mm, pud, pmd) \ 59#define pud_populate(mm, pud, pmd) \
50 set_pud(pud, __pud(_PAGE_TABLE + __pa(pmd))) 60 set_pud(pud, __pud(_PAGE_TABLE + __pa(pmd)))
51 61
62#ifdef CONFIG_64BIT
52#define set_pud(pudptr, pudval) set_64bit((phys_t *) (pudptr), pud_val(pudval)) 63#define set_pud(pudptr, pudval) set_64bit((phys_t *) (pudptr), pud_val(pudval))
64#else
65#define set_pud(pudptr, pudval) (*(pudptr) = (pudval))
66#endif
67
53static inline int pgd_newpage(pgd_t pgd) 68static inline int pgd_newpage(pgd_t pgd)
54{ 69{
55 return(pgd_val(pgd) & _PAGE_NEWPAGE); 70 return(pgd_val(pgd) & _PAGE_NEWPAGE);
@@ -57,7 +72,11 @@ static inline int pgd_newpage(pgd_t pgd)
57 72
58static inline void pgd_mkuptodate(pgd_t pgd) { pgd_val(pgd) &= ~_PAGE_NEWPAGE; } 73static inline void pgd_mkuptodate(pgd_t pgd) { pgd_val(pgd) &= ~_PAGE_NEWPAGE; }
59 74
75#ifdef CONFIG_64BIT
60#define set_pmd(pmdptr, pmdval) set_64bit((phys_t *) (pmdptr), pmd_val(pmdval)) 76#define set_pmd(pmdptr, pmdval) set_64bit((phys_t *) (pmdptr), pmd_val(pmdval))
77#else
78#define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval))
79#endif
61 80
62struct mm_struct; 81struct mm_struct;
63extern pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address); 82extern pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address);
diff --git a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h
index bec4840d30ea..62ab94a4f1b6 100644
--- a/include/asm-um/pgtable.h
+++ b/include/asm-um/pgtable.h
@@ -262,7 +262,7 @@ static inline void set_pte(pte_t *pteptr, pte_t pteval)
262 262
263#define phys_to_page(phys) pfn_to_page(phys_to_pfn(phys)) 263#define phys_to_page(phys) pfn_to_page(phys_to_pfn(phys))
264#define __virt_to_page(virt) phys_to_page(__pa(virt)) 264#define __virt_to_page(virt) phys_to_page(__pa(virt))
265#define page_to_phys(page) pfn_to_phys(page_to_pfn(page)) 265#define page_to_phys(page) pfn_to_phys((pfn_t) page_to_pfn(page))
266#define virt_to_page(addr) __virt_to_page((const unsigned long) addr) 266#define virt_to_page(addr) __virt_to_page((const unsigned long) addr)
267 267
268#define mk_pte(page, pgprot) \ 268#define mk_pte(page, pgprot) \