Vegard Nossum | 77ef50a | 2008-06-18 17:08:48 +0200 | [diff] [blame] | 1 | #ifndef ASM_X86__PAGE_32_H |
| 2 | #define ASM_X86__PAGE_32_H |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | /* |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 5 | * This handles the memory map. |
| 6 | * |
| 7 | * A __PAGE_OFFSET of 0xC0000000 means that the kernel has |
| 8 | * a virtual address space of one gigabyte, which limits the |
| 9 | * amount of physical memory you can use to about 950MB. |
| 10 | * |
| 11 | * If you want more physical memory than this then see the CONFIG_HIGHMEM4G |
| 12 | * and CONFIG_HIGHMEM64G options in the kernel configuration. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | */ |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 14 | #define __PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL) |
Jeremy Fitzhardinge | 3dc494e | 2007-05-02 19:27:13 +0200 | [diff] [blame] | 15 | |
Christoph Lameter | b84200b | 2008-04-28 18:52:40 -0700 | [diff] [blame] | 16 | #ifdef CONFIG_4KSTACKS |
| 17 | #define THREAD_ORDER 0 |
| 18 | #else |
| 19 | #define THREAD_ORDER 1 |
| 20 | #endif |
| 21 | #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) |
| 22 | |
| 23 | |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 24 | #ifdef CONFIG_X86_PAE |
Jeremy Fitzhardinge | ad524d4 | 2008-06-06 10:21:39 +0100 | [diff] [blame] | 25 | /* 44=32+12, the limit we can fit into an unsigned long pfn */ |
| 26 | #define __PHYSICAL_MASK_SHIFT 44 |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 27 | #define __VIRTUAL_MASK_SHIFT 32 |
| 28 | #define PAGETABLE_LEVELS 3 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | #ifndef __ASSEMBLY__ |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 31 | typedef u64 pteval_t; |
| 32 | typedef u64 pmdval_t; |
| 33 | typedef u64 pudval_t; |
| 34 | typedef u64 pgdval_t; |
| 35 | typedef u64 pgprotval_t; |
| 36 | typedef u64 phys_addr_t; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | |
Jeremy Fitzhardinge | c8e5393 | 2008-01-30 13:32:57 +0100 | [diff] [blame] | 38 | typedef union { |
| 39 | struct { |
| 40 | unsigned long pte_low, pte_high; |
| 41 | }; |
| 42 | pteval_t pte; |
| 43 | } pte_t; |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 44 | #endif /* __ASSEMBLY__ |
| 45 | */ |
| 46 | #else /* !CONFIG_X86_PAE */ |
| 47 | #define __PHYSICAL_MASK_SHIFT 32 |
| 48 | #define __VIRTUAL_MASK_SHIFT 32 |
| 49 | #define PAGETABLE_LEVELS 2 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 51 | #ifndef __ASSEMBLY__ |
| 52 | typedef unsigned long pteval_t; |
| 53 | typedef unsigned long pmdval_t; |
| 54 | typedef unsigned long pudval_t; |
| 55 | typedef unsigned long pgdval_t; |
| 56 | typedef unsigned long pgprotval_t; |
| 57 | typedef unsigned long phys_addr_t; |
David Woodhouse | cd469e0 | 2006-04-27 15:48:08 +0100 | [diff] [blame] | 58 | |
Joe Perches | 095d1c4 | 2008-03-23 01:02:57 -0700 | [diff] [blame] | 59 | typedef union { |
| 60 | pteval_t pte; |
| 61 | pteval_t pte_low; |
| 62 | } pte_t; |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 63 | |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 64 | #endif /* __ASSEMBLY__ */ |
| 65 | #endif /* CONFIG_X86_PAE */ |
| 66 | |
Ingo Molnar | 3bf8f5a | 2008-02-09 00:15:06 +0100 | [diff] [blame] | 67 | #ifndef __ASSEMBLY__ |
| 68 | typedef struct page *pgtable_t; |
| 69 | #endif |
| 70 | |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 71 | #ifdef CONFIG_HUGETLB_PAGE |
| 72 | #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA |
| 73 | #endif |
| 74 | |
| 75 | #ifndef __ASSEMBLY__ |
Joe Perches | 095d1c4 | 2008-03-23 01:02:57 -0700 | [diff] [blame] | 76 | #define __phys_addr(x) ((x) - PAGE_OFFSET) |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 77 | #define __phys_reloc_hide(x) RELOC_HIDE((x), 0) |
| 78 | |
| 79 | #ifdef CONFIG_FLATMEM |
| 80 | #define pfn_valid(pfn) ((pfn) < max_mapnr) |
| 81 | #endif /* CONFIG_FLATMEM */ |
| 82 | |
| 83 | extern int nx_enabled; |
| 84 | |
| 85 | /* |
| 86 | * This much address space is reserved for vmalloc() and iomap() |
| 87 | * as well as fixmap mappings. |
| 88 | */ |
| 89 | extern unsigned int __VMALLOC_RESERVE; |
| 90 | extern int sysctl_legacy_va_layout; |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 91 | |
| 92 | #define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE) |
Joe Perches | 095d1c4 | 2008-03-23 01:02:57 -0700 | [diff] [blame] | 93 | #define MAXMEM (-__PAGE_OFFSET - __VMALLOC_RESERVE) |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 94 | |
Yinghai Lu | 2ec65f8 | 2008-06-23 03:05:30 -0700 | [diff] [blame] | 95 | extern void find_low_pfn_range(void); |
Yinghai Lu | 4e29684 | 2008-06-24 12:18:14 -0700 | [diff] [blame] | 96 | extern unsigned long init_memory_mapping(unsigned long start, |
| 97 | unsigned long end); |
Yinghai Lu | 2ec65f8 | 2008-06-23 03:05:30 -0700 | [diff] [blame] | 98 | extern void initmem_init(unsigned long, unsigned long); |
Jaswinder Singh | a80495e | 2008-07-23 17:33:57 +0530 | [diff] [blame] | 99 | extern void free_initmem(void); |
Yinghai Lu | b2ac82a | 2008-06-22 02:45:39 -0700 | [diff] [blame] | 100 | extern void setup_bootmem_allocator(void); |
| 101 | |
| 102 | |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 103 | #ifdef CONFIG_X86_USE_3DNOW |
| 104 | #include <asm/mmx.h> |
| 105 | |
| 106 | static inline void clear_page(void *page) |
| 107 | { |
| 108 | mmx_clear_page(page); |
| 109 | } |
| 110 | |
| 111 | static inline void copy_page(void *to, void *from) |
| 112 | { |
| 113 | mmx_copy_page(to, from); |
| 114 | } |
| 115 | #else /* !CONFIG_X86_USE_3DNOW */ |
| 116 | #include <linux/string.h> |
| 117 | |
| 118 | static inline void clear_page(void *page) |
| 119 | { |
| 120 | memset(page, 0, PAGE_SIZE); |
| 121 | } |
| 122 | |
| 123 | static inline void copy_page(void *to, void *from) |
| 124 | { |
| 125 | memcpy(to, from, PAGE_SIZE); |
| 126 | } |
| 127 | #endif /* CONFIG_X86_3DNOW */ |
| 128 | #endif /* !__ASSEMBLY__ */ |
| 129 | |
Vegard Nossum | 77ef50a | 2008-06-18 17:08:48 +0200 | [diff] [blame] | 130 | #endif /* ASM_X86__PAGE_32_H */ |