1 #ifndef __ASM_GENERIC_PAGE_H
2 #define __ASM_GENERIC_PAGE_H
4 * Generic page.h implementation, for NOMMU architectures.
5 * This provides the dummy definitions for the memory management.
9 #error need to prove a real asm/page.h
13 /* PAGE_SHIFT determines the page size */
17 #define PAGE_SIZE (1 << PAGE_SHIFT)
19 #define PAGE_SIZE (1UL << PAGE_SHIFT)
21 #define PAGE_MASK (~(PAGE_SIZE-1))
23 #include <asm/setup.h>
27 #define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
28 #define free_user_page(page, addr) free_page(addr)
30 #define clear_page(page) memset((page), 0, PAGE_SIZE)
31 #define copy_page(to,from) memcpy((to), (from), PAGE_SIZE)
33 #define clear_user_page(page, vaddr, pg) clear_page(page)
34 #define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
37 * These are used to make use of C type-checking..
43 unsigned long pmd
[16];
51 typedef struct page
*pgtable_t
;
53 #define pte_val(x) ((x).pte)
54 #define pmd_val(x) ((&x)->pmd[0])
55 #define pgd_val(x) ((x).pgd)
56 #define pgprot_val(x) ((x).pgprot)
58 #define __pte(x) ((pte_t) { (x) } )
59 #define __pmd(x) ((pmd_t) { (x) } )
60 #define __pgd(x) ((pgd_t) { (x) } )
61 #define __pgprot(x) ((pgprot_t) { (x) } )
63 extern unsigned long memory_start
;
64 extern unsigned long memory_end
;
66 #endif /* !__ASSEMBLY__ */
68 #ifdef CONFIG_KERNEL_RAM_BASE_ADDRESS
69 #define PAGE_OFFSET (CONFIG_KERNEL_RAM_BASE_ADDRESS)
71 #define PAGE_OFFSET (0)
76 #define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET))
77 #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
79 #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
80 #define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
82 #define virt_to_page(addr) pfn_to_page(virt_to_pfn(addr))
83 #define page_to_virt(page) pfn_to_virt(page_to_pfn(page))
86 #define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
89 #define pfn_valid(pfn) ((pfn) < max_mapnr)
91 #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
92 ((void *)(kaddr) < (void *)memory_end))
94 #endif /* __ASSEMBLY__ */
96 #include <asm-generic/memory_model.h>
97 #include <asm-generic/getorder.h>
99 #endif /* __ASM_GENERIC_PAGE_H */