162306a36Sopenharmony_ci#ifndef _ASM_X86_PGTABLE_32_AREAS_H
262306a36Sopenharmony_ci#define _ASM_X86_PGTABLE_32_AREAS_H
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci#include <asm/cpu_entry_area.h>
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci/*
762306a36Sopenharmony_ci * Just any arbitrary offset to the start of the vmalloc VM area: the
862306a36Sopenharmony_ci * current 8MB value just means that there will be a 8MB "hole" after the
962306a36Sopenharmony_ci * physical memory until the kernel virtual memory starts.  That means that
1062306a36Sopenharmony_ci * any out-of-bounds memory accesses will hopefully be caught.
1162306a36Sopenharmony_ci * The vmalloc() routines leaves a hole of 4kB between each vmalloced
1262306a36Sopenharmony_ci * area for the same reason. ;)
1362306a36Sopenharmony_ci */
1462306a36Sopenharmony_ci#define VMALLOC_OFFSET	(8 * 1024 * 1024)
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#ifndef __ASSEMBLY__
1762306a36Sopenharmony_ciextern bool __vmalloc_start_set; /* set once high_memory is set */
1862306a36Sopenharmony_ci#endif
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci#define VMALLOC_START	((unsigned long)high_memory + VMALLOC_OFFSET)
2162306a36Sopenharmony_ci#ifdef CONFIG_X86_PAE
2262306a36Sopenharmony_ci#define LAST_PKMAP 512
2362306a36Sopenharmony_ci#else
2462306a36Sopenharmony_ci#define LAST_PKMAP 1024
2562306a36Sopenharmony_ci#endif
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#define CPU_ENTRY_AREA_PAGES		(NR_CPUS * DIV_ROUND_UP(sizeof(struct cpu_entry_area), PAGE_SIZE))
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci/* The +1 is for the readonly IDT page: */
3062306a36Sopenharmony_ci#define CPU_ENTRY_AREA_BASE	\
3162306a36Sopenharmony_ci	((FIXADDR_TOT_START - PAGE_SIZE*(CPU_ENTRY_AREA_PAGES+1)) & PMD_MASK)
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci#define LDT_BASE_ADDR		\
3462306a36Sopenharmony_ci	((CPU_ENTRY_AREA_BASE - PAGE_SIZE) & PMD_MASK)
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci#define LDT_END_ADDR		(LDT_BASE_ADDR + PMD_SIZE)
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci#define PKMAP_BASE		\
3962306a36Sopenharmony_ci	((LDT_BASE_ADDR - PAGE_SIZE) & PMD_MASK)
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci#ifdef CONFIG_HIGHMEM
4262306a36Sopenharmony_ci# define VMALLOC_END	(PKMAP_BASE - 2 * PAGE_SIZE)
4362306a36Sopenharmony_ci#else
4462306a36Sopenharmony_ci# define VMALLOC_END	(LDT_BASE_ADDR - 2 * PAGE_SIZE)
4562306a36Sopenharmony_ci#endif
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci#define MODULES_VADDR	VMALLOC_START
4862306a36Sopenharmony_ci#define MODULES_END	VMALLOC_END
4962306a36Sopenharmony_ci#define MODULES_LEN	(MODULES_VADDR - MODULES_END)
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci#define MAXMEM	(VMALLOC_END - PAGE_OFFSET - __VMALLOC_RESERVE)
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci#endif /* _ASM_X86_PGTABLE_32_AREAS_H */
54