4 #include <asm/proc/page.h>
6 #define PAGE_SIZE (1UL << PAGE_SHIFT)
7 #define PAGE_MASK (~(PAGE_SIZE-1))
12 #define STRICT_MM_TYPECHECKS
14 #define clear_page(page) memzero((void *)(page), PAGE_SIZE)
15 extern void copy_page(void *to
, void *from
);
17 #define clear_user_page(page, vaddr) clear_page(page)
18 #define copy_user_page(to, from, vaddr) copy_page(to, from)
20 #ifdef STRICT_MM_TYPECHECKS
22 * These are used to make use of C type-checking..
24 typedef struct { unsigned long pte
; } pte_t
;
25 typedef struct { unsigned long pmd
; } pmd_t
;
26 typedef struct { unsigned long pgd
; } pgd_t
;
27 typedef struct { unsigned long pgprot
; } pgprot_t
;
29 #define pte_val(x) ((x).pte)
30 #define pmd_val(x) ((x).pmd)
31 #define pgd_val(x) ((x).pgd)
32 #define pgprot_val(x) ((x).pgprot)
34 #define __pte(x) ((pte_t) { (x) } )
35 #define __pmd(x) ((pmd_t) { (x) } )
36 #define __pgd(x) ((pgd_t) { (x) } )
37 #define __pgprot(x) ((pgprot_t) { (x) } )
41 * .. while these make it easier on the compiler
43 typedef unsigned long pte_t
;
44 typedef unsigned long pmd_t
;
45 typedef unsigned long pgd_t
;
46 typedef unsigned long pgprot_t
;
48 #define pte_val(x) (x)
49 #define pmd_val(x) (x)
50 #define pgd_val(x) (x)
51 #define pgprot_val(x) (x)
56 #define __pgprot(x) (x)
59 #endif /* !__ASSEMBLY__ */
61 /* to align the pointer to the (next) page boundary */
62 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
66 extern void __bug(const char *file
, int line
, void *data
);
68 #define BUG() __bug(__FILE__, __LINE__, NULL)
69 #define PAGE_BUG(page) __bug(__FILE__, __LINE__, page)
71 /* Pure 2^n version of get_order */
72 extern __inline__
int get_order(unsigned long size
)
76 size
= (size
-1) >> (PAGE_SHIFT
-1);
85 #endif /* !__ASSEMBLY__ */
87 #include <linux/config.h>
88 #include <asm/arch/memory.h>
90 #define __pa(x) __virt_to_phys((unsigned long)(x))
91 #define __va(x) ((void *)__phys_to_virt((unsigned long)(x)))
93 #ifndef CONFIG_DISCONTIGMEM
94 #define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT) - \
95 (PHYS_OFFSET >> PAGE_SHIFT))
96 #define VALID_PAGE(page) ((page - mem_map) < max_mapnr)