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