18c2ecf20Sopenharmony_ci#ifndef _ASM_X86_PGTABLE_32_AREAS_H
28c2ecf20Sopenharmony_ci#define _ASM_X86_PGTABLE_32_AREAS_H
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#include <asm/cpu_entry_area.h>
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci/*
78c2ecf20Sopenharmony_ci * Just any arbitrary offset to the start of the vmalloc VM area: the
88c2ecf20Sopenharmony_ci * current 8MB value just means that there will be a 8MB "hole" after the
98c2ecf20Sopenharmony_ci * physical memory until the kernel virtual memory starts.  That means that
108c2ecf20Sopenharmony_ci * any out-of-bounds memory accesses will hopefully be caught.
118c2ecf20Sopenharmony_ci * The vmalloc() routines leaves a hole of 4kB between each vmalloced
128c2ecf20Sopenharmony_ci * area for the same reason. ;)
138c2ecf20Sopenharmony_ci */
148c2ecf20Sopenharmony_ci#define VMALLOC_OFFSET	(8 * 1024 * 1024)
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
178c2ecf20Sopenharmony_ciextern bool __vmalloc_start_set; /* set once high_memory is set */
188c2ecf20Sopenharmony_ci#endif
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define VMALLOC_START	((unsigned long)high_memory + VMALLOC_OFFSET)
218c2ecf20Sopenharmony_ci#ifdef CONFIG_X86_PAE
228c2ecf20Sopenharmony_ci#define LAST_PKMAP 512
238c2ecf20Sopenharmony_ci#else
248c2ecf20Sopenharmony_ci#define LAST_PKMAP 1024
258c2ecf20Sopenharmony_ci#endif
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#define CPU_ENTRY_AREA_PAGES		(NR_CPUS * DIV_ROUND_UP(sizeof(struct cpu_entry_area), PAGE_SIZE))
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci/* The +1 is for the readonly IDT page: */
308c2ecf20Sopenharmony_ci#define CPU_ENTRY_AREA_BASE	\
318c2ecf20Sopenharmony_ci	((FIXADDR_TOT_START - PAGE_SIZE*(CPU_ENTRY_AREA_PAGES+1)) & PMD_MASK)
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#define LDT_BASE_ADDR		\
348c2ecf20Sopenharmony_ci	((CPU_ENTRY_AREA_BASE - PAGE_SIZE) & PMD_MASK)
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#define LDT_END_ADDR		(LDT_BASE_ADDR + PMD_SIZE)
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#define PKMAP_BASE		\
398c2ecf20Sopenharmony_ci	((LDT_BASE_ADDR - PAGE_SIZE) & PMD_MASK)
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#ifdef CONFIG_HIGHMEM
428c2ecf20Sopenharmony_ci# define VMALLOC_END	(PKMAP_BASE - 2 * PAGE_SIZE)
438c2ecf20Sopenharmony_ci#else
448c2ecf20Sopenharmony_ci# define VMALLOC_END	(LDT_BASE_ADDR - 2 * PAGE_SIZE)
458c2ecf20Sopenharmony_ci#endif
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci#define MODULES_VADDR	VMALLOC_START
488c2ecf20Sopenharmony_ci#define MODULES_END	VMALLOC_END
498c2ecf20Sopenharmony_ci#define MODULES_LEN	(MODULES_VADDR - MODULES_END)
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci#define MAXMEM	(VMALLOC_END - PAGE_OFFSET - __VMALLOC_RESERVE)
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci#endif /* _ASM_X86_PGTABLE_32_AREAS_H */
54