* better
[mascara-docs.git] / i386 / linux-2.3.21 / include / asm-i386 / page.h
blobc3719d5d9cd19e1f0cae15253be83bda021fbf33
1 #ifndef _I386_PAGE_H
2 #define _I386_PAGE_H
4 /* PAGE_SHIFT determines the page size */
5 #define PAGE_SHIFT 12
6 #define PAGE_SIZE (1UL << PAGE_SHIFT)
7 #define PAGE_MASK (~(PAGE_SIZE-1))
9 #ifdef __KERNEL__
10 #ifndef __ASSEMBLY__
12 #define STRICT_MM_TYPECHECKS
14 #include <linux/config.h>
16 #ifdef CONFIG_X86_USE_3DNOW
18 #include <asm/mmx.h>
20 #define clear_page(page) mmx_clear_page(page)
21 #define copy_page(to,from) mmx_copy_page(to,from)
23 #else
26 * On older X86 processors its not a win to use MMX here it seems.
27 * Maybe the K6-III ?
30 #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
31 #define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE)
33 #endif
35 #ifdef STRICT_MM_TYPECHECKS
37 * These are used to make use of C type-checking..
39 typedef struct { unsigned long pte; } pte_t;
40 typedef struct { unsigned long pmd; } pmd_t;
41 typedef struct { unsigned long pgd; } pgd_t;
42 typedef struct { unsigned long pgprot; } pgprot_t;
44 #define pte_val(x) ((x).pte)
45 #define pmd_val(x) ((x).pmd)
46 #define pgd_val(x) ((x).pgd)
47 #define pgprot_val(x) ((x).pgprot)
49 #define __pte(x) ((pte_t) { (x) } )
50 #define __pmd(x) ((pmd_t) { (x) } )
51 #define __pgd(x) ((pgd_t) { (x) } )
52 #define __pgprot(x) ((pgprot_t) { (x) } )
54 #else
56 * .. while these make it easier on the compiler
58 typedef unsigned long pte_t;
59 typedef unsigned long pmd_t;
60 typedef unsigned long pgd_t;
61 typedef unsigned long pgprot_t;
63 #define pte_val(x) (x)
64 #define pmd_val(x) (x)
65 #define pgd_val(x) (x)
66 #define pgprot_val(x) (x)
68 #define __pte(x) (x)
69 #define __pmd(x) (x)
70 #define __pgd(x) (x)
71 #define __pgprot(x) (x)
73 #endif
74 #endif /* !__ASSEMBLY__ */
76 /* to align the pointer to the (next) page boundary */
77 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
80 * This handles the memory map.. We could make this a config
81 * option, but too many people screw it up, and too few need
82 * it.
84 * A __PAGE_OFFSET of 0xC0000000 means that the kernel has
85 * a virtual address space of one gigabyte, which limits the
86 * amount of physical memory you can use to about 950MB. If
87 * you want to use more physical memory, change this define.
89 * For example, if you have 2GB worth of physical memory, you
90 * could change this define to 0x80000000, which gives the
91 * kernel 2GB of virtual memory (enough to most of your physical memory
92 * as the kernel needs a bit extra for various io-memory mappings)
94 * IF YOU CHANGE THIS, PLEASE ALSO CHANGE
96 * arch/i386/vmlinux.lds
98 * which has the same constant encoded..
101 #include <asm/page_offset.h>
103 #define __PAGE_OFFSET (PAGE_OFFSET_RAW)
105 #ifndef __ASSEMBLY__
107 #define BUG() do { \
108 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
109 __asm__ __volatile__(".byte 0x0f,0x0b"); \
110 } while (0)
112 #define PAGE_BUG(page) do { \
113 BUG(); \
114 } while (0)
116 #endif /* __ASSEMBLY__ */
118 #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
119 #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
120 #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
121 #define MAP_NR(addr) (__pa(addr) >> PAGE_SHIFT)
122 #define PHYSMAP_NR(addr) ((unsigned long)(addr) >> PAGE_SHIFT)
124 #endif /* __KERNEL__ */
126 #endif /* _I386_PAGE_H */