|
37 | 37 |
|
38 | 38 |
|
39 | 39 | /*
|
40 |
| - * If KASLR is enabled, then an offset K is added to the kernel address |
41 |
| - * space. The bottom 21 bits of this offset are zero to guarantee 2MB |
42 |
| - * alignment for PA and VA. |
43 |
| - * |
44 |
| - * For each pagetable level of the swapper, we know that the shift will |
45 |
| - * be larger than 21 (for the 4KB granule case we use section maps thus |
46 |
| - * the smallest shift is actually 30) thus there is the possibility that |
47 |
| - * KASLR can increase the number of pagetable entries by 1, so we make |
48 |
| - * room for this extra entry. |
49 |
| - * |
50 |
| - * Note KASLR cannot increase the number of required entries for a level |
51 |
| - * by more than one because it increments both the virtual start and end |
52 |
| - * addresses equally (the extra entry comes from the case where the end |
53 |
| - * address is just pushed over a boundary and the start address isn't). |
| 40 | + * A relocatable kernel may execute from an address that differs from the one at |
| 41 | + * which it was linked. In the worst case, its runtime placement may intersect |
| 42 | + * with two adjacent PGDIR entries, which means that an additional page table |
| 43 | + * may be needed at each subordinate level. |
54 | 44 | */
|
55 |
| - |
56 |
| -#ifdef CONFIG_RANDOMIZE_BASE |
57 |
| -#define EARLY_KASLR (1) |
58 |
| -#else |
59 |
| -#define EARLY_KASLR (0) |
60 |
| -#endif |
| 45 | +#define EXTRA_PAGE __is_defined(CONFIG_RELOCATABLE) |
61 | 46 |
|
62 | 47 | #define SPAN_NR_ENTRIES(vstart, vend, shift) \
|
63 | 48 | ((((vend) - 1) >> (shift)) - ((vstart) >> (shift)) + 1)
|
|
83 | 68 | + EARLY_PGDS((vstart), (vend), add) /* each PGDIR needs a next level page table */ \
|
84 | 69 | + EARLY_PUDS((vstart), (vend), add) /* each PUD needs a next level page table */ \
|
85 | 70 | + EARLY_PMDS((vstart), (vend), add)) /* each PMD needs a next level page table */
|
86 |
| -#define INIT_DIR_SIZE (PAGE_SIZE * EARLY_PAGES(KIMAGE_VADDR, _end, EARLY_KASLR)) |
| 71 | +#define INIT_DIR_SIZE (PAGE_SIZE * EARLY_PAGES(KIMAGE_VADDR, _end, EXTRA_PAGE)) |
87 | 72 |
|
88 | 73 | /* the initial ID map may need two extra pages if it needs to be extended */
|
89 | 74 | #if VA_BITS < 48
|
|
0 commit comments