]>
Commit | Line | Data |
---|---|---|
fb355149 JF |
1 | #ifndef _ASM_X86_PGTABLE_64_DEFS_H |
2 | #define _ASM_X86_PGTABLE_64_DEFS_H | |
3 | ||
8170e6be PA |
4 | #include <asm/sparsemem.h> |
5 | ||
54321d94 JF |
6 | #ifndef __ASSEMBLY__ |
7 | #include <linux/types.h> | |
a95ae27c | 8 | #include <asm/kaslr.h> |
54321d94 JF |
9 | |
10 | /* | |
11 | * These are used to make use of C type-checking.. | |
12 | */ | |
13 | typedef unsigned long pteval_t; | |
14 | typedef unsigned long pmdval_t; | |
15 | typedef unsigned long pudval_t; | |
fe1e8c3e | 16 | typedef unsigned long p4dval_t; |
54321d94 JF |
17 | typedef unsigned long pgdval_t; |
18 | typedef unsigned long pgprotval_t; | |
19 | ||
20 | typedef struct { pteval_t pte; } pte_t; | |
21 | ||
22 | #endif /* !__ASSEMBLY__ */ | |
23 | ||
fb355149 JF |
24 | #define SHARED_KERNEL_PMD 0 |
25 | ||
b8504058 KS |
26 | #ifdef CONFIG_X86_5LEVEL |
27 | ||
28 | /* | |
29 | * PGDIR_SHIFT determines what a top-level page table entry can map | |
30 | */ | |
31 | #define PGDIR_SHIFT 48 | |
32 | #define PTRS_PER_PGD 512 | |
33 | ||
34 | /* | |
35 | * 4th level page in 5-level paging case | |
36 | */ | |
37 | #define P4D_SHIFT 39 | |
38 | #define PTRS_PER_P4D 512 | |
39 | #define P4D_SIZE (_AC(1, UL) << P4D_SHIFT) | |
40 | #define P4D_MASK (~(P4D_SIZE - 1)) | |
41 | ||
42 | #else /* CONFIG_X86_5LEVEL */ | |
43 | ||
fb355149 JF |
44 | /* |
45 | * PGDIR_SHIFT determines what a top-level page table entry can map | |
46 | */ | |
47 | #define PGDIR_SHIFT 39 | |
48 | #define PTRS_PER_PGD 512 | |
49 | ||
b8504058 KS |
50 | #endif /* CONFIG_X86_5LEVEL */ |
51 | ||
fb355149 JF |
52 | /* |
53 | * 3rd level page | |
54 | */ | |
55 | #define PUD_SHIFT 30 | |
56 | #define PTRS_PER_PUD 512 | |
57 | ||
58 | /* | |
59 | * PMD_SHIFT determines the size of the area a middle-level | |
60 | * page table can map | |
61 | */ | |
62 | #define PMD_SHIFT 21 | |
63 | #define PTRS_PER_PMD 512 | |
64 | ||
65 | /* | |
66 | * entries per page directory level | |
67 | */ | |
68 | #define PTRS_PER_PTE 512 | |
69 | ||
70 | #define PMD_SIZE (_AC(1, UL) << PMD_SHIFT) | |
71 | #define PMD_MASK (~(PMD_SIZE - 1)) | |
72 | #define PUD_SIZE (_AC(1, UL) << PUD_SHIFT) | |
73 | #define PUD_MASK (~(PUD_SIZE - 1)) | |
74 | #define PGDIR_SIZE (_AC(1, UL) << PGDIR_SHIFT) | |
75 | #define PGDIR_MASK (~(PGDIR_SIZE - 1)) | |
76 | ||
c898faf9 | 77 | /* See Documentation/x86/x86_64/mm.txt for a description of the memory map. */ |
a95ae27c | 78 | #define MAXMEM _AC(__AC(1, UL) << MAX_PHYSMEM_BITS, UL) |
4c7c4483 KS |
79 | #ifdef CONFIG_X86_5LEVEL |
80 | #define VMALLOC_SIZE_TB _AC(16384, UL) | |
81 | #define __VMALLOC_BASE _AC(0xff92000000000000, UL) | |
82 | #define __VMEMMAP_BASE _AC(0xffd4000000000000, UL) | |
83 | #else | |
a95ae27c TG |
84 | #define VMALLOC_SIZE_TB _AC(32, UL) |
85 | #define __VMALLOC_BASE _AC(0xffffc90000000000, UL) | |
25dfe478 | 86 | #define __VMEMMAP_BASE _AC(0xffffea0000000000, UL) |
4c7c4483 | 87 | #endif |
a95ae27c TG |
88 | #ifdef CONFIG_RANDOMIZE_MEMORY |
89 | #define VMALLOC_START vmalloc_base | |
25dfe478 | 90 | #define VMEMMAP_START vmemmap_base |
a95ae27c TG |
91 | #else |
92 | #define VMALLOC_START __VMALLOC_BASE | |
25dfe478 | 93 | #define VMEMMAP_START __VMEMMAP_BASE |
a95ae27c TG |
94 | #endif /* CONFIG_RANDOMIZE_MEMORY */ |
95 | #define VMALLOC_END (VMALLOC_START + _AC((VMALLOC_SIZE_TB << 40) - 1, UL)) | |
6145cfe3 | 96 | #define MODULES_VADDR (__START_KERNEL_map + KERNEL_IMAGE_SIZE) |
f06bdd40 TG |
97 | /* The module sections ends with the start of the fixmap */ |
98 | #define MODULES_END __fix_to_virt(__end_of_fixed_addresses + 1) | |
fb355149 | 99 | #define MODULES_LEN (MODULES_END - MODULES_VADDR) |
3891a04a | 100 | #define ESPFIX_PGD_ENTRY _AC(-2, UL) |
1d33b219 | 101 | #define ESPFIX_BASE_ADDR (ESPFIX_PGD_ENTRY << P4D_SHIFT) |
8266e31e MK |
102 | #define EFI_VA_START ( -4 * (_AC(1, UL) << 30)) |
103 | #define EFI_VA_END (-68 * (_AC(1, UL) << 30)) | |
fb355149 | 104 | |
8170e6be PA |
105 | #define EARLY_DYNAMIC_PAGE_TABLES 64 |
106 | ||
fb355149 | 107 | #endif /* _ASM_X86_PGTABLE_64_DEFS_H */ |