* add p cc
[mascara-docs.git] / i386 / linux / linux-2.3.21 / include / asm-ppc / page.h
blobb67ca5cc0f9e98b33266ec3189ddd20e3db689be
1 #include <linux/config.h>
3 #ifndef _PPC_PAGE_H
4 #define _PPC_PAGE_H
6 /* PAGE_SHIFT determines the page size */
7 #define PAGE_SHIFT 12
8 #define PAGE_SIZE (1UL << PAGE_SHIFT)
9 #define PAGE_MASK (~(PAGE_SIZE-1))
11 #define PAGE_OFFSET 0xc0000000
12 #define KERNELBASE PAGE_OFFSET
14 #ifndef __ASSEMBLY__
15 #ifdef __KERNEL__
17 #ifdef CONFIG_XMON
18 #define BUG() do { \
19 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
20 xmon(0); \
21 } while (0)
22 #else
23 #define BUG() do { \
24 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
25 __asm__ __volatile__(".long 0x0"); \
26 } while (0)
27 #endif
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) } )
51 #else
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)
65 #define __pte(x) (x)
66 #define __pmd(x) (x)
67 #define __pgd(x) (x)
68 #define __pgprot(x) (x)
70 #endif
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)
85 unsigned long p;
86 asm volatile ("1: addis %0, %1, %2;"
87 ".section \".vtop_fixup\",\"aw\";"
88 ".align 1;"
89 ".long 1b;"
90 ".previous;"
91 : "=r" (p)
92 : "b" (v), "K" (((-PAGE_OFFSET) >> 16) & 0xffff));
94 return p;
96 static inline void* ___va(unsigned long p)
98 unsigned long v;
99 asm volatile ("1: addis %0, %1, %2;"
100 ".section \".ptov_fixup\",\"aw\";"
101 ".align 1;"
102 ".long 1b;"
103 ".previous;"
104 : "=r" (v)
105 : "b" (p), "K" (((PAGE_OFFSET) >> 16) & 0xffff));
107 return (void*) v;
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 */