1 #ifndef _ASM_X86_PAGE_H_ 2 #define _ASM_X86_PAGE_H_ 3 /* 4 * Copyright (C) 2016, Red Hat Inc, Alexander Gordeev <agordeev@redhat.com> 5 * 6 * This work is licensed under the terms of the GNU LGPL, version 2. 7 */ 8 9 10 #include <linux/const.h> 11 12 #define PAGE_SHIFT 12 13 #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) 14 #define PAGE_MASK (~(PAGE_SIZE-1)) 15 16 #ifndef __ASSEMBLY__ 17 18 #ifdef __x86_64__ 19 #define LARGE_PAGE_SIZE (512 * PAGE_SIZE) 20 #else 21 #define LARGE_PAGE_SIZE (1024 * PAGE_SIZE) 22 #endif 23 24 #define PTE_PRESENT (1ull << 0) 25 #define PTE_WRITE (1ull << 1) 26 #define PTE_USER (1ull << 2) 27 #define PTE_PSE (1ull << 7) 28 #define PTE_ADDR (0xffffffffff000ull) 29 30 #ifdef __x86_64__ 31 #define PAGE_LEVEL 4 32 #define PGDIR_WIDTH 9 33 #define PGDIR_MASK 511 34 #else 35 #define PAGE_LEVEL 2 36 #define PGDIR_WIDTH 10 37 #define PGDIR_MASK 1023 38 #endif 39 40 #endif /* !__ASSEMBLY__ */ 41 #endif 42