diff options
author | Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> | 2005-09-10 19:44:56 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-10 12:00:18 -0700 |
commit | d99c4022f60a9aa3a8dc6b7d71f3d0998c696912 (patch) | |
tree | d02de9d131b3d45a21ce60e4b5d3380497f86daf /arch | |
parent | 4413a511f22ec771edc0b7c93e5b34e05511acb5 (diff) | |
download | blackbird-op-linux-d99c4022f60a9aa3a8dc6b7d71f3d0998c696912.tar.gz blackbird-op-linux-d99c4022f60a9aa3a8dc6b7d71f3d0998c696912.zip |
[PATCH] uml: inline mk_pte and various friends
Turns out that, for UML, a *lot* of VM-related trivial functions are not
inlined but rather normal functions.
In other sections of UML code, this is justified by having files which
interact with the host and cannot therefore include kernel headers, but in
this case there's no such justification.
I've had to turn many of them to macros because of missing declarations. While
doing this, I've decided to reuse some already existing macros.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/um/include/mem.h | 12 | ||||
-rw-r--r-- | arch/um/kernel/ksyms.c | 5 | ||||
-rw-r--r-- | arch/um/kernel/physmem.c | 35 |
3 files changed, 11 insertions, 41 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); extern int is_remapped(void *virt); extern int physmem_remove_mapping(void *virt); extern void physmem_forget_descriptor(int fd); -extern unsigned long to_phys(void *virt); + +extern unsigned long uml_physmem; +static inline unsigned long to_phys(void *virt) +{ + return(((unsigned long) virt) - uml_physmem); +} + +static inline void *to_virt(unsigned long phys) +{ + return((void *) uml_physmem + phys); +} #endif 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); EXPORT_SYMBOL(arch_validate); EXPORT_SYMBOL(get_kmem_end); -EXPORT_SYMBOL(page_to_phys); -EXPORT_SYMBOL(phys_to_page); EXPORT_SYMBOL(high_physmem); EXPORT_SYMBOL(empty_zero_page); EXPORT_SYMBOL(um_virt_to_phys); -EXPORT_SYMBOL(__virt_to_page); -EXPORT_SYMBOL(to_phys); -EXPORT_SYMBOL(to_virt); EXPORT_SYMBOL(mode_tt); EXPORT_SYMBOL(handle_page_fault); EXPORT_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; extern unsigned long physmem_size; -void *to_virt(unsigned long phys) -{ - return((void *) uml_physmem + phys); -} - -unsigned long to_phys(void *virt) -{ - return(((unsigned long) virt) - uml_physmem); -} - int init_maps(unsigned long physmem, unsigned long iomem, unsigned long highmem) { struct page *p, *map; @@ -298,31 +288,6 @@ int init_maps(unsigned long physmem, unsigned long iomem, unsigned long highmem) return(0); } -struct page *phys_to_page(const unsigned long phys) -{ - return(&mem_map[phys >> PAGE_SHIFT]); -} - -struct page *__virt_to_page(const unsigned long virt) -{ - return(&mem_map[__pa(virt) >> PAGE_SHIFT]); -} - -phys_t page_to_phys(struct page *page) -{ - return((page - mem_map) << PAGE_SHIFT); -} - -pte_t mk_pte(struct page *page, pgprot_t pgprot) -{ - pte_t pte; - - pte_set_val(pte, page_to_phys(page), pgprot); - if(pte_present(pte)) - pte_mknewprot(pte_mknewpage(pte)); - return(pte); -} - /* Changed during early boot */ static unsigned long kmem_top = 0; |