1 #include <linux/config.h>
6 /* PAGE_SHIFT determines the page size */
8 #define PAGE_SIZE (1UL << PAGE_SHIFT)
9 #define PAGE_MASK (~(PAGE_SIZE-1))
11 #define PAGE_OFFSET 0xc0000000
12 #define KERNELBASE PAGE_OFFSET
19 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
24 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
25 __asm__ __volatile__(".long 0x0"); \
28 #define PAGE_BUG(page) do { BUG(); } while (0)
30 #define STRICT_MM_TYPECHECKS
32 #ifdef STRICT_MM_TYPECHECKS
34 * These are used to make use of C type-checking..
36 typedef struct { unsigned long pte
; } pte_t
;
37 typedef struct { unsigned long pmd
; } pmd_t
;
38 typedef struct { unsigned long pgd
; } pgd_t
;
39 typedef struct { unsigned long pgprot
; } pgprot_t
;
41 #define pte_val(x) ((x).pte)
42 #define pmd_val(x) ((x).pmd)
43 #define pgd_val(x) ((x).pgd)
44 #define pgprot_val(x) ((x).pgprot)
46 #define __pte(x) ((pte_t) { (x) } )
47 #define __pmd(x) ((pmd_t) { (x) } )
48 #define __pgd(x) ((pgd_t) { (x) } )
49 #define __pgprot(x) ((pgprot_t) { (x) } )
53 * .. while these make it easier on the compiler
55 typedef unsigned long pte_t
;
56 typedef unsigned long pmd_t
;
57 typedef unsigned long pgd_t
;
58 typedef unsigned long pgprot_t
;
60 #define pte_val(x) (x)
61 #define pmd_val(x) (x)
62 #define pgd_val(x) (x)
63 #define pgprot_val(x) (x)
68 #define __pgprot(x) (x)
73 /* align addr on a size boundry - adjust address up if needed -- Cort */
74 #define _ALIGN(addr,size) (((addr)+size-1)&(~(size-1)))
76 /* to align the pointer to the (next) page boundary */
77 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
79 extern void clear_page(unsigned long page
);
80 #define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE)
82 /* map phys->virtual and virtual->phys for RAM pages */
83 static inline unsigned long ___pa(unsigned long v
)
86 asm volatile ("1: addis %0, %1, %2;"
87 ".section \".vtop_fixup\",\"aw\";"
92 : "b" (v
), "K" (((-PAGE_OFFSET
) >> 16) & 0xffff));
96 static inline void* ___va(unsigned long p
)
99 asm volatile ("1: addis %0, %1, %2;"
100 ".section \".ptov_fixup\",\"aw\";"
105 : "b" (p
), "K" (((PAGE_OFFSET
) >> 16) & 0xffff));
109 #define __pa(x) ___pa ((unsigned long)(x))
110 #define __va(x) ___va ((unsigned long)(x))
112 #define MAP_NR(addr) (((unsigned long)addr-PAGE_OFFSET) >> PAGE_SHIFT)
113 #define MAP_PAGE_RESERVED (1<<15)
115 extern unsigned long get_zero_page_fast(void);
116 #endif /* __KERNEL__ */
117 #endif /* __ASSEMBLY__ */
118 #endif /* _PPC_PAGE_H */