aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/um/include/mem.h12
-rw-r--r--arch/um/kernel/ksyms.c5
-rw-r--r--arch/um/kernel/physmem.c35
-rw-r--r--include/asm-um/page.h3
-rw-r--r--include/asm-um/pgtable.h16
5 files changed, 23 insertions, 48 deletions
diff --git a/arch/um/include/mem.h b/arch/um/include/mem.h
index 99d3ad4a03e5..e8ff0d8fa610 100644
--- a/arch/um/include/mem.h
+++ b/arch/um/include/mem.h
@@ -13,7 +13,17 @@ extern int physmem_subst_mapping(void *virt, int fd, __u64 offset, int w);
13extern int is_remapped(void *virt); 13extern int is_remapped(void *virt);
14extern int physmem_remove_mapping(void *virt); 14extern int physmem_remove_mapping(void *virt);
15extern void physmem_forget_descriptor(int fd); 15extern void physmem_forget_descriptor(int fd);
16extern unsigned long to_phys(void *virt); 16
17extern unsigned long uml_physmem;
18static inline unsigned long to_phys(void *virt)
19{
20 return(((unsigned long) virt) - uml_physmem);
21}
22
23static inline void *to_virt(unsigned long phys)
24{
25 return((void *) uml_physmem + phys);
26}
17 27
18#endif 28#endif
19 29
diff --git a/arch/um/kernel/ksyms.c b/arch/um/kernel/ksyms.c
index 32d3076dd220..a97a72e516aa 100644
--- a/arch/um/kernel/ksyms.c
+++ b/arch/um/kernel/ksyms.c
@@ -34,14 +34,9 @@ EXPORT_SYMBOL(host_task_size);
34EXPORT_SYMBOL(arch_validate); 34EXPORT_SYMBOL(arch_validate);
35EXPORT_SYMBOL(get_kmem_end); 35EXPORT_SYMBOL(get_kmem_end);
36 36
37EXPORT_SYMBOL(page_to_phys);
38EXPORT_SYMBOL(phys_to_page);
39EXPORT_SYMBOL(high_physmem); 37EXPORT_SYMBOL(high_physmem);
40EXPORT_SYMBOL(empty_zero_page); 38EXPORT_SYMBOL(empty_zero_page);
41EXPORT_SYMBOL(um_virt_to_phys); 39EXPORT_SYMBOL(um_virt_to_phys);
42EXPORT_SYMBOL(__virt_to_page);
43EXPORT_SYMBOL(to_phys);
44EXPORT_SYMBOL(to_virt);
45EXPORT_SYMBOL(mode_tt); 40EXPORT_SYMBOL(mode_tt);
46EXPORT_SYMBOL(handle_page_fault); 41EXPORT_SYMBOL(handle_page_fault);
47EXPORT_SYMBOL(find_iomem); 42EXPORT_SYMBOL(find_iomem);
diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c
index a24e3b7f4bf0..ea670fcc8af5 100644
--- a/arch/um/kernel/physmem.c
+++ b/arch/um/kernel/physmem.c
@@ -248,16 +248,6 @@ unsigned long high_physmem;
248 248
249extern unsigned long physmem_size; 249extern unsigned long physmem_size;
250 250
251void *to_virt(unsigned long phys)
252{
253 return((void *) uml_physmem + phys);
254}
255
256unsigned long to_phys(void *virt)
257{
258 return(((unsigned long) virt) - uml_physmem);
259}
260
261int init_maps(unsigned long physmem, unsigned long iomem, unsigned long highmem) 251int init_maps(unsigned long physmem, unsigned long iomem, unsigned long highmem)
262{ 252{
263 struct page *p, *map; 253 struct page *p, *map;
@@ -298,31 +288,6 @@ int init_maps(unsigned long physmem, unsigned long iomem, unsigned long highmem)
298 return(0); 288 return(0);
299} 289}
300 290
301struct page *phys_to_page(const unsigned long phys)
302{
303 return(&mem_map[phys >> PAGE_SHIFT]);
304}
305
306struct page *__virt_to_page(const unsigned long virt)
307{
308 return(&mem_map[__pa(virt) >> PAGE_SHIFT]);
309}
310
311phys_t page_to_phys(struct page *page)
312{
313 return((page - mem_map) << PAGE_SHIFT);
314}
315
316pte_t mk_pte(struct page *page, pgprot_t pgprot)
317{
318 pte_t pte;
319
320 pte_set_val(pte, page_to_phys(page), pgprot);
321 if(pte_present(pte))
322 pte_mknewprot(pte_mknewpage(pte));
323 return(pte);
324}
325
326/* Changed during early boot */ 291/* Changed during early boot */
327static unsigned long kmem_top = 0; 292static unsigned long kmem_top = 0;
328 293
diff --git a/include/asm-um/page.h b/include/asm-um/page.h
index bd850a249183..2c192abe9aeb 100644
--- a/include/asm-um/page.h
+++ b/include/asm-um/page.h
@@ -96,8 +96,7 @@ extern unsigned long uml_physmem;
96 96
97#define __va_space (8*1024*1024) 97#define __va_space (8*1024*1024)
98 98
99extern unsigned long to_phys(void *virt); 99#include "mem.h"
100extern void *to_virt(unsigned long phys);
101 100
102/* Cast to unsigned long before casting to void * to avoid a warning from 101/* Cast to unsigned long before casting to void * to avoid a warning from
103 * mmap_kmem about cutting a long long down to a void *. Not sure that 102 * mmap_kmem about cutting a long long down to a void *. Not sure that
diff --git a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h
index b48e0966ecd7..ed06170e0edd 100644
--- a/include/asm-um/pgtable.h
+++ b/include/asm-um/pgtable.h
@@ -326,14 +326,22 @@ static inline void set_pte(pte_t *pteptr, pte_t pteval)
326} 326}
327#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) 327#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
328 328
329extern phys_t page_to_phys(struct page *page);
330
331/* 329/*
332 * Conversion functions: convert a page and protection to a page entry, 330 * Conversion functions: convert a page and protection to a page entry,
333 * and a page entry and page directory to the page they refer to. 331 * and a page entry and page directory to the page they refer to.
334 */ 332 */
335 333
336extern pte_t mk_pte(struct page *page, pgprot_t pgprot); 334#define phys_to_page(phys) pfn_to_page(phys_to_pfn(phys))
335#define __virt_to_page(virt) phys_to_page(__pa(virt))
336#define page_to_phys(page) pfn_to_phys(page_to_pfn(page))
337
338#define mk_pte(page, pgprot) \
339 ({ pte_t pte; \
340 \
341 pte_set_val(pte, page_to_phys(page), (pgprot)); \
342 if (pte_present(pte)) \
343 pte_mknewprot(pte_mknewpage(pte)); \
344 pte;})
337 345
338static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 346static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
339{ 347{
@@ -410,8 +418,6 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
410#endif 418#endif
411#endif 419#endif
412 420
413extern struct page *phys_to_page(const unsigned long phys);
414extern struct page *__virt_to_page(const unsigned long virt);
415#define virt_to_page(addr) __virt_to_page((const unsigned long) addr) 421#define virt_to_page(addr) __virt_to_page((const unsigned long) addr)
416 422
417/* 423/*