Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [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 | |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 16 | #ifdef CONFIG_X86_PAE |
Jeremy Fitzhardinge | ad524d4 | 2008-06-06 10:21:39 +0100 | [diff] [blame] | 17 | /* 44=32+12, the limit we can fit into an unsigned long pfn */ |
| 18 | #define __PHYSICAL_MASK_SHIFT 44 |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 19 | #define __VIRTUAL_MASK_SHIFT 32 |
| 20 | #define PAGETABLE_LEVELS 3 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | #ifndef __ASSEMBLY__ |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 23 | typedef u64 pteval_t; |
| 24 | typedef u64 pmdval_t; |
| 25 | typedef u64 pudval_t; |
| 26 | typedef u64 pgdval_t; |
| 27 | typedef u64 pgprotval_t; |
| 28 | typedef u64 phys_addr_t; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | |
Jeremy Fitzhardinge | c8e5393 | 2008-01-30 13:32:57 +0100 | [diff] [blame] | 30 | typedef union { |
| 31 | struct { |
| 32 | unsigned long pte_low, pte_high; |
| 33 | }; |
| 34 | pteval_t pte; |
| 35 | } pte_t; |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 36 | #endif /* __ASSEMBLY__ |
| 37 | */ |
| 38 | #else /* !CONFIG_X86_PAE */ |
| 39 | #define __PHYSICAL_MASK_SHIFT 32 |
| 40 | #define __VIRTUAL_MASK_SHIFT 32 |
| 41 | #define PAGETABLE_LEVELS 2 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 43 | #ifndef __ASSEMBLY__ |
| 44 | typedef unsigned long pteval_t; |
| 45 | typedef unsigned long pmdval_t; |
| 46 | typedef unsigned long pudval_t; |
| 47 | typedef unsigned long pgdval_t; |
| 48 | typedef unsigned long pgprotval_t; |
| 49 | typedef unsigned long phys_addr_t; |
David Woodhouse | cd469e0 | 2006-04-27 15:48:08 +0100 | [diff] [blame] | 50 | |
Joe Perches | 095d1c4 | 2008-03-23 01:02:57 -0700 | [diff] [blame] | 51 | typedef union { |
| 52 | pteval_t pte; |
| 53 | pteval_t pte_low; |
| 54 | } pte_t; |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 55 | |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 56 | #endif /* __ASSEMBLY__ */ |
| 57 | #endif /* CONFIG_X86_PAE */ |
| 58 | |
Ingo Molnar | 3bf8f5a | 2008-02-09 00:15:06 +0100 | [diff] [blame] | 59 | #ifndef __ASSEMBLY__ |
| 60 | typedef struct page *pgtable_t; |
| 61 | #endif |
| 62 | |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 63 | #ifdef CONFIG_HUGETLB_PAGE |
| 64 | #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA |
| 65 | #endif |
| 66 | |
| 67 | #ifndef __ASSEMBLY__ |
Joe Perches | 095d1c4 | 2008-03-23 01:02:57 -0700 | [diff] [blame] | 68 | #define __phys_addr(x) ((x) - PAGE_OFFSET) |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 69 | #define __phys_reloc_hide(x) RELOC_HIDE((x), 0) |
| 70 | |
| 71 | #ifdef CONFIG_FLATMEM |
| 72 | #define pfn_valid(pfn) ((pfn) < max_mapnr) |
| 73 | #endif /* CONFIG_FLATMEM */ |
| 74 | |
| 75 | extern int nx_enabled; |
| 76 | |
| 77 | /* |
| 78 | * This much address space is reserved for vmalloc() and iomap() |
| 79 | * as well as fixmap mappings. |
| 80 | */ |
| 81 | extern unsigned int __VMALLOC_RESERVE; |
| 82 | extern int sysctl_legacy_va_layout; |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 83 | |
| 84 | #define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE) |
Joe Perches | 095d1c4 | 2008-03-23 01:02:57 -0700 | [diff] [blame] | 85 | #define MAXMEM (-__PAGE_OFFSET - __VMALLOC_RESERVE) |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 86 | |
| 87 | #ifdef CONFIG_X86_USE_3DNOW |
| 88 | #include <asm/mmx.h> |
| 89 | |
| 90 | static inline void clear_page(void *page) |
| 91 | { |
| 92 | mmx_clear_page(page); |
| 93 | } |
| 94 | |
| 95 | static inline void copy_page(void *to, void *from) |
| 96 | { |
| 97 | mmx_copy_page(to, from); |
| 98 | } |
| 99 | #else /* !CONFIG_X86_USE_3DNOW */ |
| 100 | #include <linux/string.h> |
| 101 | |
| 102 | static inline void clear_page(void *page) |
| 103 | { |
| 104 | memset(page, 0, PAGE_SIZE); |
| 105 | } |
| 106 | |
| 107 | static inline void copy_page(void *to, void *from) |
| 108 | { |
| 109 | memcpy(to, from, PAGE_SIZE); |
| 110 | } |
| 111 | #endif /* CONFIG_X86_3DNOW */ |
| 112 | #endif /* !__ASSEMBLY__ */ |
| 113 | |
| 114 | #endif /* _ASM_X86_PAGE_32_H */ |