diff options
Diffstat (limited to 'include/asm-x86_64/page.h')
-rw-r--r-- | include/asm-x86_64/page.h | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h index 10f346165cab..b17fc16ec2eb 100644 --- a/include/asm-x86_64/page.h +++ b/include/asm-x86_64/page.h | |||
@@ -1,14 +1,11 @@ | |||
1 | #ifndef _X86_64_PAGE_H | 1 | #ifndef _X86_64_PAGE_H |
2 | #define _X86_64_PAGE_H | 2 | #define _X86_64_PAGE_H |
3 | 3 | ||
4 | #include <asm/const.h> | ||
4 | 5 | ||
5 | /* PAGE_SHIFT determines the page size */ | 6 | /* PAGE_SHIFT determines the page size */ |
6 | #define PAGE_SHIFT 12 | 7 | #define PAGE_SHIFT 12 |
7 | #ifdef __ASSEMBLY__ | 8 | #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) |
8 | #define PAGE_SIZE (0x1 << PAGE_SHIFT) | ||
9 | #else | ||
10 | #define PAGE_SIZE (1UL << PAGE_SHIFT) | ||
11 | #endif | ||
12 | #define PAGE_MASK (~(PAGE_SIZE-1)) | 9 | #define PAGE_MASK (~(PAGE_SIZE-1)) |
13 | #define PHYSICAL_PAGE_MASK (~(PAGE_SIZE-1) & __PHYSICAL_MASK) | 10 | #define PHYSICAL_PAGE_MASK (~(PAGE_SIZE-1) & __PHYSICAL_MASK) |
14 | 11 | ||
@@ -33,10 +30,10 @@ | |||
33 | #define N_EXCEPTION_STACKS 5 /* hw limit: 7 */ | 30 | #define N_EXCEPTION_STACKS 5 /* hw limit: 7 */ |
34 | 31 | ||
35 | #define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1)) | 32 | #define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1)) |
36 | #define LARGE_PAGE_SIZE (1UL << PMD_SHIFT) | 33 | #define LARGE_PAGE_SIZE (_AC(1,UL) << PMD_SHIFT) |
37 | 34 | ||
38 | #define HPAGE_SHIFT PMD_SHIFT | 35 | #define HPAGE_SHIFT PMD_SHIFT |
39 | #define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) | 36 | #define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT) |
40 | #define HPAGE_MASK (~(HPAGE_SIZE - 1)) | 37 | #define HPAGE_MASK (~(HPAGE_SIZE - 1)) |
41 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) | 38 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) |
42 | 39 | ||
@@ -64,6 +61,8 @@ typedef struct { unsigned long pgd; } pgd_t; | |||
64 | 61 | ||
65 | typedef struct { unsigned long pgprot; } pgprot_t; | 62 | typedef struct { unsigned long pgprot; } pgprot_t; |
66 | 63 | ||
64 | extern unsigned long phys_base; | ||
65 | |||
67 | #define pte_val(x) ((x).pte) | 66 | #define pte_val(x) ((x).pte) |
68 | #define pmd_val(x) ((x).pmd) | 67 | #define pmd_val(x) ((x).pmd) |
69 | #define pud_val(x) ((x).pud) | 68 | #define pud_val(x) ((x).pud) |
@@ -76,29 +75,25 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
76 | #define __pgd(x) ((pgd_t) { (x) } ) | 75 | #define __pgd(x) ((pgd_t) { (x) } ) |
77 | #define __pgprot(x) ((pgprot_t) { (x) } ) | 76 | #define __pgprot(x) ((pgprot_t) { (x) } ) |
78 | 77 | ||
79 | #define __PHYSICAL_START ((unsigned long)CONFIG_PHYSICAL_START) | 78 | #endif /* !__ASSEMBLY__ */ |
80 | #define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START) | ||
81 | #define __START_KERNEL_map 0xffffffff80000000UL | ||
82 | #define __PAGE_OFFSET 0xffff810000000000UL | ||
83 | 79 | ||
84 | #else | ||
85 | #define __PHYSICAL_START CONFIG_PHYSICAL_START | 80 | #define __PHYSICAL_START CONFIG_PHYSICAL_START |
81 | #define __KERNEL_ALIGN 0x200000 | ||
86 | #define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START) | 82 | #define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START) |
87 | #define __START_KERNEL_map 0xffffffff80000000 | 83 | #define __START_KERNEL_map 0xffffffff80000000 |
88 | #define __PAGE_OFFSET 0xffff810000000000 | 84 | #define __PAGE_OFFSET 0xffff810000000000 |
89 | #endif /* !__ASSEMBLY__ */ | ||
90 | 85 | ||
91 | /* to align the pointer to the (next) page boundary */ | 86 | /* to align the pointer to the (next) page boundary */ |
92 | #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) | 87 | #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) |
93 | 88 | ||
94 | /* See Documentation/x86_64/mm.txt for a description of the memory map. */ | 89 | /* See Documentation/x86_64/mm.txt for a description of the memory map. */ |
95 | #define __PHYSICAL_MASK_SHIFT 46 | 90 | #define __PHYSICAL_MASK_SHIFT 46 |
96 | #define __PHYSICAL_MASK ((1UL << __PHYSICAL_MASK_SHIFT) - 1) | 91 | #define __PHYSICAL_MASK ((_AC(1,UL) << __PHYSICAL_MASK_SHIFT) - 1) |
97 | #define __VIRTUAL_MASK_SHIFT 48 | 92 | #define __VIRTUAL_MASK_SHIFT 48 |
98 | #define __VIRTUAL_MASK ((1UL << __VIRTUAL_MASK_SHIFT) - 1) | 93 | #define __VIRTUAL_MASK ((_AC(1,UL) << __VIRTUAL_MASK_SHIFT) - 1) |
99 | 94 | ||
100 | #define KERNEL_TEXT_SIZE (40UL*1024*1024) | 95 | #define KERNEL_TEXT_SIZE (40*1024*1024) |
101 | #define KERNEL_TEXT_START 0xffffffff80000000UL | 96 | #define KERNEL_TEXT_START 0xffffffff80000000 |
102 | 97 | ||
103 | #ifndef __ASSEMBLY__ | 98 | #ifndef __ASSEMBLY__ |
104 | 99 | ||
@@ -106,21 +101,19 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
106 | 101 | ||
107 | #endif /* __ASSEMBLY__ */ | 102 | #endif /* __ASSEMBLY__ */ |
108 | 103 | ||
109 | #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) | 104 | #define PAGE_OFFSET __PAGE_OFFSET |
110 | 105 | ||
111 | /* Note: __pa(&symbol_visible_to_c) should be always replaced with __pa_symbol. | 106 | /* Note: __pa(&symbol_visible_to_c) should be always replaced with __pa_symbol. |
112 | Otherwise you risk miscompilation. */ | 107 | Otherwise you risk miscompilation. */ |
113 | #define __pa(x) (((unsigned long)(x)>=__START_KERNEL_map)?(unsigned long)(x) - (unsigned long)__START_KERNEL_map:(unsigned long)(x) - PAGE_OFFSET) | 108 | #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET) |
114 | /* __pa_symbol should be used for C visible symbols. | 109 | /* __pa_symbol should be used for C visible symbols. |
115 | This seems to be the official gcc blessed way to do such arithmetic. */ | 110 | This seems to be the official gcc blessed way to do such arithmetic. */ |
116 | #define __pa_symbol(x) \ | 111 | #define __pa_symbol(x) \ |
117 | ({unsigned long v; \ | 112 | ({unsigned long v; \ |
118 | asm("" : "=r" (v) : "0" (x)); \ | 113 | asm("" : "=r" (v) : "0" (x)); \ |
119 | __pa(v); }) | 114 | ((v - __START_KERNEL_map) + phys_base); }) |
120 | 115 | ||
121 | #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) | 116 | #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) |
122 | #define __boot_va(x) __va(x) | ||
123 | #define __boot_pa(x) __pa(x) | ||
124 | #ifdef CONFIG_FLATMEM | 117 | #ifdef CONFIG_FLATMEM |
125 | #define pfn_valid(pfn) ((pfn) < end_pfn) | 118 | #define pfn_valid(pfn) ((pfn) < end_pfn) |
126 | #endif | 119 | #endif |